HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


OCF Notifications

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#35657 (In Topic #8039)
Avatar

Community saint

Ok what I'm trying to do is have the forum notification popup also popup anywhere on the site not just on the forum the only problem is I'm having some problems finding where its being called.

Thanks in advance
Aldun

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35665
Avatar

This is hardcoded into the ocf_wrapper function in the sources/ocf_general.php file.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35672
Avatar

Community saint

So in essence I could create a block to utilize this code? Or do I need to hard code it into global.php or somthing along those lines?

Code

   // Notifications

   if ((get_member()!=$GLOBALS['OCF_DRIVER']->get_guest_id()) && ((get_page_name()=='forumview') || (get_page_name()=='topicview')))

   {

      $cache_identifier=serialize(array(get_member()));

      $_notifications=NULL;

      if (get_option('is_on_block_cache')=='1') $_notifications=get_cache_entry('_new_pp',$cache_identifier,10000);

      if (is_null($_notifications))

      {

         $unread_pps=ocf_get_pp_rows();

         $notifications=new ocp_tempcode();

         $num_unread_pps=0;

         foreach ($unread_pps as $unread_pp)

         {

            $by=$GLOBALS['OCF_DRIVER']->get_username($unread_pp['p_poster']);

            if (is_null($by)) $by=do_lang('UNKNOWN');

            $u_title=$unread_pp['t_cache_first_title'];

            if (is_null($unread_pp['t_forum_id']))

            {

               $type=do_lang(($unread_pp['t_cache_first_post_id']==$unread_pp['id'])?'NEW_PT_NOTIFICATION':'NEW_PP_NOTIFICATION');

               $num_unread_pps++;

               $reply_url=build_url(array('page'=>'topics','type'=>'new_post','id'=>$unread_pp['p_topic_id'],'quote'=>$unread_pp['id']),get_module_zone('topics'));

            } else

            {

               $type=do_lang('ADD_INLINE_PERSONAL_POST');

               if ($unread_pp['p_title']!='') $u_title=$unread_pp['p_title'];

               $reply_url=build_url(array('page'=>'topics','type'=>'new_post','id'=>$unread_pp['p_topic_id'],'quote'=>$unread_pp['id'],'intended_solely_for'=>$unread_pp['p_poster']),get_module_zone('topics'));

            }

            $time_raw=$unread_pp['p_time'];

            $time=do_timezoned_date($unread_pp['p_time']);

            $topic=$GLOBALS['OCF_DRIVER']->post_link($unread_pp['id'],NULL);

            $post=ocf_clean_post_for_tooltip(text_lookup_comcode($unread_pp['p_post'],$GLOBALS['FORUM_DB']));

            $description=$unread_pp['t_description'];

            if ($description!='') $description=' ('.$description.')';

            $profile_link=$GLOBALS['OCF_DRIVER']->member_profile_link($unread_pp['p_poster']);

            $redirect_url=get_self_url(true,true);

            $ignore_url=build_url(array('page'=>'topics','type'=>'mark_read_topic','id'=>$unread_pp['p_topic_id'],'redirect_url'=>$redirect_url),get_module_zone('topics'));

            $notifications->attach(do_template('OCF_NOTIFICATION',array('_GUID'=>'3b224ea3f4da2f8f869a505b9756970a','ID'=>strval($unread_pp['id']),'U_TITLE'=>$u_title,'IGNORE_URL'=>$ignore_url,'REPLY_URL'=>$reply_url,'TOPIC_URL'=>$topic,'POST'=>$post,'DESCRIPTION'=>$description,'TIME'=>$time,'TIME_RAW'=>strval($time_raw),'BY'=>$by,'PROFILE_LINK'=>$profile_link,'TYPE'=>$type)));

         }



         put_into_cache('_new_pp',60*60*24,$cache_identifier,array($notifications->to_assembly(),$num_unread_pps));

      } else

      {

         list($__notifications,$num_unread_pps)=$_notifications;

         $notifications=new ocp_tempcode();

         $notifications->from_assembly($__notifications);

      }

   } else

   {

      $notifications=new ocp_tempcode();

      $num_unread_pps=0;

   }
 

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35675
Avatar

if you put…

Code

<?php

require_code('ocf_general');
at the top of that, and…

Code

$notifications->evaluate_echo();

?>
at the end of that.

And saved into sources/miniblocks/notifications.php, then I think that might work as a block called notifications. I haven't tried it but the code segment you extracted looks self-contained apart from those little bits I just added.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35694
Avatar

Community saint

ok the block is there but it doesn't seem to be doing anything but doesn't return any errors either.

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35699
Avatar

The obvious question is if there are any notifications for it to show...


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35701
Avatar

Community saint

yes I have one showing in the forum but not on the home page

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35782
Avatar

Ah yes, small mistake on my part. Strip this bit of code:

Code

 && ((get_page_name()=='forumview') || (get_page_name()=='topicview'))
It's within a line, near the top.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35783
Avatar

Community saint

Ah… Now I get errors.

Code

Parse error: syntax error, unexpected '{' in /sources/miniblocks/notifications.php on line 9
If I get rid of the '{' on line 9 I get the following.

Code

Parse error: syntax error, unexpected T_VARIABLE in /sources/miniblocks/notifications.php on line 10
Sorry I'm not incredibly good with PHP I know some but apparently not enough.
 

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35799
Avatar

I think you removed the final bracket by mistake. PHP was saying it didn't expect a '{' because it was still in brackets.

Here's that line stripped to the minimum:

Code

if (get_member()!=$GLOBALS['OCF_DRIVER']->get_guest_id())


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35801
Avatar

Community saint

 and now I get this error.

Code

Fatal error: Call to undefined function: ocf_clean_post_for_tooltip() in /sources/miniblocks/notifications.php on line 65

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35802
Avatar

We're getting there. Not sure why I didn't get that, but you need to add this line below the similar line about ocf_general:

Code

require_code('ocf_posts');


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35832
Avatar

Community saint

Ok the blocks works but now when I use it the notifications mess up on the forums.

This is what happens

Code

You have a new personal topic

";i:3;N;}i:1;a:4:{i:0;a:0:{}i:1;i:2;i:2;s:27:"NEW_PT_NOTIFICATION_DETAILS";i:3;a:4:{i:0;O:12:"ocp_tempcode":2:{s:4:"bits";a:1:{i:0;a:4:{i:0;a:1:{i:0;i:1;}i:1;i:1;i:2;s:4:"test";i:3;N;}}s:8:"codename";s:16:"OCF_NOTIFICATION";}i:1;s:0:"";i:2;O:12:"ocp_tempcode":2:{s:4:"bits";a:3:{i:0;a:4:{i:0;a:0:{}i:1;i:1;i:2;s:78:"testAlduntest<";i:3;N;}i:1;a:4:{i:0;a:0:{}i:1;i:1;i:2;s:1:"/";i:3;N;}i:2;a:4:{i:0;a:0:{}i:1;i:1;i:2;s:2:"a>";i:3;N;}}s:8:"codename";s:16:"OCF_NOTIFICATION";}i:3;O:12:"ocp_tempcode":2:{s:4:"bits";a:1:{i:0;a:4:{i:0;a:1:{i:0;i:1;}i:1;i:1;i:2;s:26:"10 October, 2007, 12:28 AM";i:3;N;}}s:8:"codename";s:16:"OCF_NOTIFICATION";}}}i:2;a:4:{i:0;a:0:{}i:1;i:1;i:2;s:234:"

testtesttesttesttesttest



 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
Posted
Rating:
#35907
Avatar

I'm baffled by this I'm afraid. It's working fine from here, and I can't work out how that problem would happen. I can say that what you're seeing is 'Raw assembled Tempcode', which is what the notifications are cached under.

Perhaps your code is different to mine.
This is mine:

Code

<?php

   require_code('ocf_general');
   require_code('ocf_posts');

   // Notifications
   if (get_member()!=$GLOBALS['OCF_DRIVER']->get_guest_id())
   {
      $cache_identifier=serialize(array(get_member()));
      $_notifications=NULL;
      if (get_option('is_on_block_cache')=='1') $_notifications=get_cache_entry('_new_pp',$cache_identifier,10000);
      if (is_null($_notifications))
      {
         $unread_pps=ocf_get_pp_rows();
         $notifications=new ocp_tempcode();
         $num_unread_pps=0;
         foreach ($unread_pps as $unread_pp)
         {
            $by=$GLOBALS['OCF_DRIVER']->get_username($unread_pp['p_poster']);
            if (is_null($by)) $by=do_lang('UNKNOWN');
            $u_title=$unread_pp['t_cache_first_title'];
            if (is_null($unread_pp['t_forum_id']))
            {
               $type=do_lang(($unread_pp['t_cache_first_post_id']==$unread_pp['id'])?'NEW_PT_NOTIFICATION':'NEW_PP_NOTIFICATION');
               $num_unread_pps++;
               $reply_url=build_url(array('page'=>'topics','type'=>'new_post','id'=>$unread_pp['p_topic_id'],'quote'=>$unread_pp['id']),get_module_zone('topics'));
            } else
            {
               $type=do_lang('ADD_INLINE_PERSONAL_POST');
               if ($unread_pp['p_title']!='') $u_title=$unread_pp['p_title'];
               $reply_url=build_url(array('page'=>'topics','type'=>'new_post','id'=>$unread_pp['p_topic_id'],'quote'=>$unread_pp['id'],'intended_solely_for'=>$unread_pp['p_poster']),get_module_zone('topics'));
            }
            $time_raw=$unread_pp['p_time'];
            $time=do_timezoned_date($unread_pp['p_time']);
            $topic=$GLOBALS['OCF_DRIVER']->post_link($unread_pp['id'],NULL);
            $post=ocf_clean_post_for_tooltip(text_lookup_comcode($unread_pp['p_post'],$GLOBALS['FORUM_DB']));
            $description=$unread_pp['t_description'];
            if ($description!='') $description=' ('.$description.')';
            $profile_link=$GLOBALS['OCF_DRIVER']->member_profile_link($unread_pp['p_poster']);
            $redirect_url=get_self_url(true,true);
            $ignore_url=build_url(array('page'=>'topics','type'=>'mark_read_topic','id'=>$unread_pp['p_topic_id'],'redirect_url'=>$redirect_url),get_module_zone('topics'));
            $notifications->attach(do_template('OCF_NOTIFICATION',array('_GUID'=>'3b224ea3f4da2f8f869a505b9756970a','ID'=>strval($unread_pp['id']),'U_TITLE'=>$u_title,'IGNORE_URL'=>$ignore_url,'REPLY_URL'=>$reply_url,'TOPIC_URL'=>$topic,'POST'=>$post,'DESCRIPTION'=>$description,'TIME'=>$time,'TIME_RAW'=>strval($time_raw),'BY'=>$by,'PROFILE_LINK'=>$profile_link,'TYPE'=>$type)));
         }

         put_into_cache('_new_pp',60*60*24,$cache_identifier,array($notifications->to_assembly(),$num_unread_pps));
      } else
      {
         list($__notifications,$num_unread_pps)=$_notifications;
         $notifications=new ocp_tempcode();
         $notifications->from_assembly($__notifications);
      }
   } else
   {
      $notifications=new ocp_tempcode();
      $num_unread_pps=0;
   }

   $notifications->evaluate_echo();

?>


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#35908
Avatar

Community saint

sorry, forgot to update it only happens when I'm on my work computer so it has a problem with IE6 my site has a lot of problems with IE6

 I'm not real big on building skins as of right now but if you would like some custom graphics done for your site I am more than willing as long as I have the time. -\-PhrozenStudios-/-
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: