71
coops
Adding SQL to theme.html
  • 2005/7/24 11:42

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


I want to query the database (for how many messages there are in my inbox), so I can add it to my theme.

I have the ipboard module so the answer on the FAQ doesnt work. Heres the query:

Quote:
//<<<--------------------------------------------
//-+- IPB messages new -- Koudadnshi
//<<<--------------------------------------------
if ($isbb)
{
list($new_messages) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("ipb_messages")." WHERE recipient_id = '".$xoopsUser->getVar("uid")."' AND vid='in' AND read_state='0' "));
$block['new_messages'] = $new_messages;
}
else
$block['new_messages'] = $pm_handler->getCount($criteria);
//>>>--------------------------------------------


Now, how do I get that query ...

($xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("ipb_messages")." WHERE recipient_id = '".$xoopsUser->getVar("uid")."' AND vid='in' AND read_state='0' "));)

...to display the count of messages
eg Inbox (1)

??



72
coops
x-ipbm to newbb?!
  • 2005/7/23 5:39

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


I have searched high and low to no avail... is there a converter to go from x-ipbm to newbb?

Predator said there was one here
..but i cant seem to find it!

Seems like many are up in there air about this. Anyone got clarity? He mentioned it will be included in the final release of newbb2

Does that mean it's part of newbb2? Or did it never get released? That was at the end of last year!

Somebody?... Anybody?...



73
coops
IPBM and new messages
  • 2005/7/20 6:22

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Hi i am using ipbm,

I would like to include the "Inbox (3)" in my theme.html
I found this tutorial

Unfortunately I think the core files are modified by ipbm, so I need to know how to edit this for the new core files:

Top of theme.html:
<{if $xoops_isuser}>
<{
php}>
GLOBAL 
$xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
$criteria->add(new Criteria('to_userid'$uid));
$msgcount $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount'$msgcount);
<{/
php}>
<{/if}>



In theme.html:
<{if $msgcount 0}>
<
class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<
a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>



How do I change the above code to fit the core files that ipbm includes?

heres what ipbm user menu looks like: (to get an idea of the new messages)

function b_system_user_show()
{
   global 
$xoopsUser;
      global 
$isbb$xoopsDB;
   if (
is_object($xoopsUser)) {
       
$pm_handler =& xoops_gethandler('privmessage');
       
$block = array();
       
$block['lang_youraccount'] = _MB_SYSTEM_VACNT;
       
$block['lang_editaccount'] = _MB_SYSTEM_EACNT;
       
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
       
$block['uid'] = $xoopsUser->getVar('uid');
       
$block['lang_logout'] = _MB_SYSTEM_LOUT;
       
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
       
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));

 
//<<<--------------------------------------------
 //-+- IPB messages new -- Koudadnshi
 //<<<--------------------------------------------
 
if ($isbb)
 {
     list(
$new_messages) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("ipb_messages")." WHERE recipient_id = '".$xoopsUser->getVar("uid")."' AND vid='in' AND read_state='0' "));
  
$block['new_messages'] = $new_messages;
 }
 else
  
$block['new_messages'] = $pm_handler->getCount($criteria);  
 
//>>>--------------------------------------------
 
       
$block['lang_inbox'] = _MB_SYSTEM_INBOX;
       
$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
       return 
$block;
   }
   return 
false;
}


I tried on their site, but nobody helps there. Im still learning php... im sure this will take one of you 5 or 10 mins, please some support!?



74
coops
Re: Notify of new messges?
  • 2005/7/19 11:53

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Is this the wrong place to ask?



75
coops
Re: Notify of new messges?
  • 2005/7/18 6:01

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Ive posted this on the bbpixel forum too. Does nobody know?



76
coops
Notify of new messges?
  • 2005/7/17 9:27

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Hi, I have seen threads on how to put a notification of new messages in your theme, but I am using the ipb forum module, which edits core files

Please help so I can change my site!

Here is the way it is done in the user menu, system_blocks.php (edited for the ipb module):

function b_system_user_show()
{
   global 
$xoopsUser;
      global 
$isbb$xoopsDB;
   if (
is_object($xoopsUser)) {
       
$pm_handler =& xoops_gethandler('privmessage');
       
$block = array();
       
$block['lang_youraccount'] = _MB_SYSTEM_VACNT;
       
$block['lang_editaccount'] = _MB_SYSTEM_EACNT;
       
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
       
$block['uid'] = $xoopsUser->getVar('uid');
       
$block['lang_logout'] = _MB_SYSTEM_LOUT;
       
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
       
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));

 
//<<<--------------------------------------------
 //-+- IPB messages new -- Koudadnshi
 //<<<--------------------------------------------
 
if ($isbb)
 {
     list(
$new_messages) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("ipb_messages")." WHERE recipient_id = '".$xoopsUser->getVar("uid")."' AND vid='in' AND read_state='0' "));
  
$block['new_messages'] = $new_messages;
 }
 else
  
$block['new_messages'] = $pm_handler->getCount($criteria);  
 
//>>>--------------------------------------------
 
       
$block['lang_inbox'] = _MB_SYSTEM_INBOX;
       
$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
       return 
$block;
   }
   return 
false;
}


..........and here is the way they suggest it to be done (without the ipb module)...


Above header:

<{if 
$xoops_isuser}>
<{
php}>
GLOBAL 
$xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
$criteria->add(new Criteria('to_userid'$uid));
$msgcount $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount'$msgcount);
<{/
php}>
<{/if}>

In page:
<{if 
$msgcount 0}>
<
class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<
a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>


Can someone who knows php put this together to make a code that displays the New Message count that I can put anywhere in my theme? Im sure it would only take 10 mins or so...



77
coops
Re: Auto-moving members to groups: Is it possible?
  • 2005/6/16 9:13

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


also, what are the rules for bumping topics?



78
coops
Re: Auto-moving members to groups: Is it possible?
  • 2005/6/15 11:37

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


hmm, is it possible to type in the code at any time, or is it only possible at registration? i need it so at any stage they can change groups...



79
coops
Auto-moving members to groups: Is it possible?
  • 2005/6/15 3:57

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Hey I want to set something up on my site so that when a user visits a certain page they are automatically moved from one group to another.

Eg: Registered user visits page -----> automatically moved to Team Member group

I know the security concerns, the "Team member group" just includes access to another module

Is it possible?




TopTop
« 1 ... 5 6 7 (8)



Login

Who's Online

138 user(s) are online (99 user(s) are browsing Support Forums)


Members: 0


Guests: 138


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits