• I have the required code in the header.php page. The code I’m using is being used on my own PHP on my currect active site. I’m trying to move over to WP, and I’d like to have a way for WP to recognize my SMF User’s information, including which Membergroups they are part of.

    Here is the code I’m using:

    <?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 I’m getting:

    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.

    Notice at the end, too, it’s printing the ‘echo’ as if the User isn’t registered.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The error tells you the problem..

    Warning: in_array() [function.in-array]: Wrong datatype for second argument

    Thread Starter Jim R

    (@jim-r)

    I realize that, but I only get that error when applying it to WP pages. It works perfectly in my own PHP pages.

    Thread Starter Jim R

    (@jim-r)

    I”m trying to get at why those errors are being produced just on WP pages, and I’m looking to see if anyone has a solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying carry SMF content into my WP…’ is closed to new replies.