Jump to content

Merging WordPress and SMF Forums...having sessions issues...


Recommended Posts

I'm trying to have my WordPress site recognize my SMF user information, specifically what Membergroup they are in.  I'm using SMF's SSI functions, but I'm not having much luck.

 

The code I'm using determines which Membergroups can see content.  From there it is to determine whether or not the User is a Guest, Registered or a Subscriber.  It works perfectly on my own PHP pages, but I'm wanting to move over to WordPress for better functionality.  I can kind of start from scratch, but I'd rather not.

 

There are not any suitable bridges or converters that I have found to work.

 

Here is the code:

 

<?php
$allowed_groups = array(1, 2, 9, 14);
$can_see = FALSE;
foreach ($allowed_groups as $allowed)
{
if (in_array($allowed, $user_info['groups']))
{
	$can_see = TRUE;
	break;
}
}

//If allowed to see...show this.
if ($can_see)
{
//Just stay right here and do nothing.

}

elseif ($can_see == FALSE && $context['user']['is_logged'])
{


//If you want to redirect the user to another place you can use the redirectexit() function.
echo 'Registered but not subscribed.';
}
else
{
//Just redirect since they are just a guest.

echo 'Not registered.';

    

}
?>

 

 

Here are the errors:  Note, that I'm allowing four Membergroups access, and I'm getting four errors.  I switched it to three Membergroups, and it produced three errors.

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/jwrbloom/public_html/wp/wp-content/plugins/php_execution/includes/class.php_execution.php(270) : eval()’d code on line 6

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/jwrbloom/public_html/wp/wp-content/plugins/php_execution/includes/class.php_execution.php(270) : eval()’d code on line 6

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/jwrbloom/public_html/wp/wp-content/plugins/php_execution/includes/class.php_execution.php(270) : eval()’d code on line 6

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/jwrbloom/public_html/wp/wp-content/plugins/php_execution/includes/class.php_execution.php(270) : eval()’d code on line 6

Not registered.

 

 

As you can see by the "Not registered" at the end, it just bypasses that the User is Registered or a Subscriber.  Again, this works on my own PHP pages. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.