*

MB Themes

Re: If socials logged in then require blablabla else relax :-)
« Reply #15 on: September 11, 2021, 01:43:34 pm »
Osc_logged_user_id
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 508 posts
Re: If socials logged in then require blablabla else relax :-)
« Reply #16 on: September 11, 2021, 03:35:40 pm »
No more errors but now it ignores if ($checkbox ['i_gdpr_tc'] !== 1)
If it is 1 or 0 it continues with script.....
I tried to use the code also in form/checkbox.php but the same happens then.
Test to see if user id gets echoed is ok but it continues showing boxes.....  :-\ 
Code: [Select]
<?phpif(osc_is_web_user_logged_in() )$user_id = osc_user_id();$checkbox = ModelGDPR::newInstance()->getGdprByUserId($user_id);if ($checkbox ['i_gdpr_tc'] !== 1) {echo "<h2>" . $user_id . "</h2>";}  else {  // redirect user to another page    header( "location: https://osclasspoint.com" ); die;} ?>
« Last Edit: September 11, 2021, 03:42:23 pm by mwindey »

*

MB Themes

Re: If socials logged in then require blablabla else relax :-)
« Reply #17 on: September 11, 2021, 03:49:33 pm »
$checkbox['i_gdpr_tc'] != 1

Osc_usee_id does not seems to be ok
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Marked as best answer by frosticek on September 11, 2021, 07:36:50 pm
*

mwindey

  • *****
  • 508 posts
Re: If socials logged in then require blablabla else relax :-)
« Reply #18 on: September 11, 2021, 05:15:49 pm »
@MB Themes, @tomi 327

Thanks guys for your support on this.....You both did it  8)
It finally works correctly now if user =1 in table user but since user is logged in with socials he/or she skipped table user and when adding a new listing table item gets updated..... The user still needs to check all boxes then.
Isn't it possible now that when a new listing is added table item and table user are getting updated at the same time?
 
Final code that works when table user is filled is:

Code: [Select]
<?php$required_fields = strtolower(osc_get_preference('post_required', 'veronika_theme'));$user_id = osc_logged_user_id();$checkbox = ModelGDPR::newInstance()->getGdprByUserId($user_id);if ($checkbox['i_gdpr_tc'] !=0) {?>

Now i only need to look in model for a way to update both tables at the same time when adding a listing. 
Anyway for now .....
Me happy now :D :D
 
« Last Edit: September 11, 2021, 05:32:27 pm by mwindey »

*

mwindey

  • *****
  • 508 posts
Re: If socials logged in then require blablabla else relax :-)
« Reply #19 on: September 13, 2021, 08:26:14 am »
My latest update did the trick to solve my problem completely.
Since i am not using table item for gdpr there is no need to fill it with $tc, $pp, $nw. Instead i am only using table user to fill and check if socials are logged and checked boxes.


In model i modified
Code: [Select]
// INSERT TC/PP ON ITEM
   public function updateItem($user_id, $tc, $pp, $nw) {
   if($user_id = osc_logged_user_id()  ) {
    $values = array(
      'i_gdpr_tc' => $tc,
      'i_gdpr_pp' => $pp,
      'i_gdpr_nw' => $nw
    );
    $this->dao->update($this->getTable_user(), $values, array('pk_i_id' => $user_id));
       }
    }



And checkbox.php checks if user has tc and pp on.....
Code: [Select]
<?php$user_id = osc_logged_user_id();$checkbox = ModelGDPR::newInstance()->getGdprByUserId($user_id);if ($checkbox['i_gdpr_tc'] !=1) {?>
......continue script....

Halfway the page i copied the same code for boxes and made them tc and pp un-visible....it continues checking for $nw
Code: [Select]
 
<?php }   }  else if ($checkbox['i_gdpr_nw'] !=1) { ?>
and only box $nw is shown.

In the end when all 3 boxes are checked there is
Code: [Select]
 
<?php }  else  {  ?>
and some text to fill.
If logged in with any kind of media it works as a charm now.....
I am posting this just in case someone needs it.
All credits to tomi 327 and Frosticek @MB Themes


 

*

MB Themes

Re: If socials logged in then require blablabla else relax :-)
« Reply #20 on: October 21, 2021, 11:12:32 am »
New major version has been released just now, solving problem of users logged in via social networks.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots