Jump to content

Display if conditions met


doddsey_65

Recommended Posts

I am working on a notice system which displays notices based on if their conditions have been met, but have run into a problem.

 

The following shows this notice to a user who is logged in and posted more than one post:

 

foreach($row as $key => $val)
            {
                $conditions[$key] = unserialize($row[$key]['n_conditions']);
                
                if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than']))
                {
                    $notices[] = $row[$key]['n_content'];
                }
        

 

but i also have a condition to show notices to users who are logged in whhich is done like so:

 

foreach($row as $key => $val)
            {
                $conditions[$key] = unserialize($row[$key]['n_conditions']);
                
                if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than']))
                {
                    $notices[] = $row[$key]['n_content'];
                }
                
                elseif($conditions[$key]['logged_in'] == 1 && logged_in(sessionsClass::$data['u_uid']))
                {
                    $notices[] = $row[$key]['n_content'];
                }

 

as you can guess this doesnt work. because the user is logged in it displays both notices regardless of how many posts they have made. Anyone have any ideas on the best method to do this?

 

Link to comment
Share on other sites

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.