phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Bookmarks Mod, adding the number

Goto page 1, 2  Next
 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Tue Nov 10, 2009 9:14 am 
Post subject: Bookmarks Mod, adding the number

Hi,

I am using this mod:
http://www.phpbbhacks.com/download/871

I would like to show the NUMBER of bookmarks in the overall_header-link.
Is that possible?

Quote:
&nbsp;<a href="{U_BOOKMARKS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_bookmark.gif" width="12" height="13" border="0" alt="{L_BOOKMARKS}" hspace="3" />{L_BOOKMARKS} (NUMBER)</a>&nbsp;


Or here:
Code:
$lang['Bookmarks'] = 'Bookmarks';

like
Code:
$lang['Bookmarks'] = 'Bookmarks (%d)';


/Holger
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 11, 2009 8:31 am 
Post subject: Re: Bookmarks Mod, adding the number

icon_redface.gif
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Wed Nov 11, 2009 10:09 pm 
Post subject: Re: Bookmarks Mod, adding the number

Not familiar with the Mod. Gimme' a sec to download and look it over.


[Edit]

Okay, I'm kinda busy, so I can't install the Mod to see for myself. Go into your phpMyAdmin and look in the USERS_TABLE for user_setbm. Tell me if that number matches up with the number of bookmarks a user has set.

(Like if you have 3 bookmarks, the number in that field for the user is 3.)
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Thu Nov 12, 2009 7:43 am 
Post subject: Re: Bookmarks Mod, adding the number

No, that does not reflect how many BMs.
That field is set to 1 if I select "Set bookmark automatically when starting a new thread" in my profile.
I think this one is the one you are looking for?
Code:
CREATE TABLE phpbb_bookmarks (
   topic_id mediumint(8) unsigned NOT NULL default '0',
   user_id mediumint(8) NOT NULL default '0',
   KEY topic_id (topic_id),
   KEY user_id (user_id));
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Tue Nov 17, 2009 3:52 pm 
Post subject: Re: Bookmarks Mod, adding the number

Any idea? icon_redface.gif
Back to top
Murmur
Board Member



Joined: 20 Aug 2009

Posts: 57
Location: California


flag
PostPosted: Tue Nov 17, 2009 5:59 pm 
Post subject: Re: Bookmarks Mod, adding the number

Just a quick answer, I'll look closer tonight.

I believe you need to do three things.

In PHP:

do a COUNT query (if the value is not already available)
assign the count to a template variable

in the overall_header template

add your new template variable (as you have shown)
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Tue Nov 17, 2009 6:46 pm 
Post subject: Re: Bookmarks Mod, adding the number

Ehm, yes icon_redface.gif
Back to top
Murmur
Board Member



Joined: 20 Aug 2009

Posts: 57
Location: California


flag
PostPosted: Wed Nov 18, 2009 5:49 am 
Post subject: Re: Bookmarks Mod, adding the number

In /includes/page_header.php

BEFORE

// Format Timezone. We are unable to u

ADD

Code:

if($userdata['user_id'] > 0) {
    $sql = "SELECT COUNT(*) AS bmcount
               FROM ".BOOKMARK_TABLE."
               WHERE user_id = " . $userdata['user_id'];
    $row = $db->sql_fetchrow($db->sql_query($sql));;
    $template->assign_var('BM_COUNT', $row['bmcount']);
    }


Change your template variable from {NUMBER} to {BM_COUNT}. "Number" is a little too generic.

Have not tested this. Also the display in overall_header.tpl should probably be within a ...

<!-- BEGIN switch_user_logged_in -->

<!-- END switch_user_logged_in -->

type of block.

Let's see what happens.......
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 18, 2009 7:50 am 
Post subject: Re: Bookmarks Mod, adding the number

The switch is already there ... thanks for the hint anyway!

I do not get any result.
Bookmarks ()

page_header.php:
Code:
if($userdata['user_id'] > 0) {
    $sql = "SELECT COUNT(*) AS bmcount
               FROM ".BOOKMARK_TABLE."
               WHERE user_id = " . $userdata['user_id'];
    $result = $db->sql_query($sql);
    $template->assign_var('BM_COUNT', $result['bmcount']);
    }

// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility


overall_header.tpl:
Code:
      <!-- BEGIN switch_user_logged_in -->
      | <a href="{U_PRIVATEMSGS}" class="nav">{PRIVATE_MESSAGE_INFO}</a> | <a href="{U_PROFILE}" class="nav">{L_PROFILE}</a> | <a href="{U_NOTES}" class="nav">{L_NOTES}</a> | <a href="{U_BOOKMARKS}" class="nav">{L_BOOKMARKS} ({BM_COUNT})</a>
      <!-- END switch_user_logged_in -->
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Wed Nov 18, 2009 8:30 am 
Post subject: Re: Bookmarks Mod, adding the number

Did you create the variable?
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Wed Nov 18, 2009 8:32 am 
Post subject: Re: Bookmarks Mod, adding the number

Maybe this
Code:
FROM ".BOOKMARK_TABLE."
should be
Code:
FROM ".BOOKMARKS_TABLE."
icon_question.gif
_________________
phpBB2 will never die, I hope!
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 18, 2009 8:51 am 
Post subject: Re: Bookmarks Mod, adding the number

Acaria wrote:
Did you create the variable?

How do you mean?
Is this not enough?
Code:
    $template->assign_var('BM_COUNT', $result['bmcount']);


BOOKMARK_TABLE is correct.
Code:
#
#-----[ OPEN ]------------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]------------------------------------------------
#
define('BANLIST_TABLE', $table_prefix.'banlist');

#
#-----[ AFTER, ADD ]------------------------------------------
#
define('BOOKMARK_TABLE', $table_prefix.'bookmarks');
Back to top
Murmur
Board Member



Joined: 20 Aug 2009

Posts: 57
Location: California


flag
PostPosted: Wed Nov 18, 2009 5:23 pm 
Post subject: Re: Bookmarks Mod, adding the number

No good, eh?

Ok. I will test it tonight and fix it.
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Nov 18, 2009 5:30 pm 
Post subject: Re: Bookmarks Mod, adding the number

No good.
Thank you for helping me!
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Wed Nov 18, 2009 10:03 pm 
Post subject: Re: Bookmarks Mod, adding the number

Yep, that's what I mean. Just wanted to make sure that had been done. ^^
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 2 All times are GMT
Goto page 1, 2  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0200 seconds using 15 queries. (SQL 0.0012 Parse 0.0007 Other 0.0181)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo