Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vB Journal | vba CMPS module: latest entries Details »»
vB Journal | vba CMPS module: latest entries
Version: 1.00, by Bolas Bolas is offline
Developer Last Online: Jul 2013 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 09-24-2004 Last Update: Never Installs: 40
 
No support by the author.

This hack is for [vB 3.0.3] - vB Journal for vBulletin 3.0.3(v1.0.0) and [vB 3.0.3]

Hi,
this is the Brahm's vbindex conversion for vba CMPS: this module will show latest journal entries in a box in your CMPS system.

demo:
http://www.wellage.net



Here we go:

touch /path_to_your_forum_dir/modules/journalentries.php
-----------------------------------------
PHP Code:
<?php
// ######################### Latest Forum Topics #########################
$getlateste$DB_site->query("
            SELECT journal_entries.entrytitle,journal_entries.entrydate,
            journal_entries.entry_id,journal_entries.entrytext,
            journal_entries.journal_id,journals.journalist,journals.journalist_id
            FROM "
.TABLE_PREFIX."journal_entries AS journal_entries
            LEFT JOIN "
.TABLE_PREFIX."journals AS journals ON (journal_entries.journal_id=journals.journal_id)
            WHERE journal_entries.entry_active=1 AND journal_entries.private!=1 AND journals.private!=1
            ORDER BY journal_entries.entrydate DESC
            LIMIT 5
            "
);
            
$countlatest$DB_site->num_rows($getlateste);
            
$latestentrybits "";
            if(
$countlatest>0)
            {
                while(
$latest$DB_site->fetch_array($getlateste))
                {
                    
$latestentrydatevbdate($vboptions['dateformat'], $latest['entrydate'], 1);
                    
$latestentrytimevbdate($vboptions['timeformat'], $latest['entrydate']);
                    
exec_switch_bg();
                    if(
strlen($latest[entrytitle])>20)
                    {
                        
$latest[entrytitle]= "".substr($latest[entrytitle],0,20)."...";
                    }
                    if(
strlen($latest[entrytext])>150)
                    {
                        
$latest[entrytext]= "".substr($latest[entrytext],0,150)."...";
                    }
                    eval(
'$latestentrybits .= "' fetch_template('journal_latestentrybits') . '";');
                }
                
$DB_site->free_result($lastest);
            }
            else
            {
                
$latestentrybits=$vbphrase['adv_no_entries'];
            }


    eval(
'$home[$mods[\'modid\']][\'content\'] = "' fetch_template('adv_portal_latestjournalentry') . '";');

    
$DB_site->free_result($getlateste);
    unset(
$latestentrybits,$latest,$latestentrytime,$latestentrydate,$countlatest);

?>


then create template 'adv_portal_latestjournalentry'
-----------------------------------------
Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
 <tr>
  <td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('cmps_pagesmenu')"><img id="collapseimg_cmps_pagesjournal" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_cmps_pagesjournal].gif" alt="" border="0" /></a>
    <span class="smallfont"><strong>$vbphrase[adv_latest_journalentries]</strong></span>
  </td>
 </tr>
</thead>
<tbody id="collapseobj_cmps_pagesjournal" style="$vbcollapse[collapseobj_cmps_pagesjournal];text-align:$stylevar[left]">
$latestentrybits
</tbody>
</table>
<br />


Now add 2 GLOBAL phrases:
$vbphrase[adv_latest_journalentries] = "Latest Journal Entries"
$vbphrase[adv_no_entries] = "No Journal Entries"



Then create a new module:
Module Title: Journal Latest Entries
File to include: journalentries.php
Active: yes... -.-'
Column: right|left
Templates Used: adv_portal_latestjournalentry, journal_latestentrybits


Have fun and don't forget to :-)





UPDATE (10/17/2004):
- added 2 modified version of 'journal_latestentrybits' for right|left or center block (thanx to Billbensen for center version) - see attachments [ billbensen__centered_block.txt]
- Valentino Rossi Wins! :devious:

UPDATE (10/20/2004):
- patched template collapse id, please change your old template with new version. (thx to memobug for debugging)




thx to
AN-net for his Journal hack
Brahm for the vBindex version of this module.
Billbensen for modified version of journal_latestentrybits template

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 10-18-2004, 04:38 AM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would it be possible to take only the most recent entry per journalist to avoid someone spamming the latest entries, so to speak? It seems like it should be possible with a GROUPing of some type, but the only solutions of this type I found online were sublinked queries that made my head hurt.

Regards,

Matt
Reply With Quote
  #23  
Old 10-18-2004, 02:14 PM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by memobug
Greetings
1. It looks like this is a typo, should probably be "latest"
Mumble... the error is in Billbensen modification of my add-on. I will send a mail to him to correct is code...
_______________________________

Quote:
Originally Posted by memobug
2. It is necessary to use stripslashes in a couple of places to prevent escaped quotes, i.e., Fred\'s Comment
Just inside the while loop add:
Code:
	 $latest[entrytitle]="".stripslashes($latest[entrytitle]);
	 $latest[entrytext]="".stripslashes($latest[entrytext]);
Don't ask me what the "". part is about, I'm just making it consistent with the existing code.
identical to 1.
_______________________________

Quote:
Originally Posted by memobug
3. I added in a count of the comments in both the query and the templatebits
nice, but use only an OL list?
Code:
<ol>
 <li>blah<li>
</ol>
_______________________________

Quote:
Originally Posted by memobug
4. It would be very helpful if the hack installation instructions identify specifically (by link) which Journal it is intended for use. I think I have found about three threads that claim to be vbJournal and several versions of some.

At any rate it looks like it's incompatible with my version of "vbJournal" - now I have to figure out which version that is. Some port of Ryangel's hack I found on vbtemplates.org, I think.
At the end of the first post you can see the Thx Section:
Quote:
Originally Posted by bolas
thx to
AN-net for his Journal hack
Brahm for the vBindex version of this module.
Billbensen for modified version of journal_latestentrybits template
...and also only one hack is called exactly vbJournal.
But you're right: I will change the title setting also hack version..
_______________________________

Quote:
Originally Posted by memobug
5. I was able to modify the query and get everything to work with my version of the Journal, with the exception of this one parameter:

$latest[journalist], (journals.journalist), because that is a field I don't have in my database. I'm assuming that is the proper name of the Journal keeper, but I am a little surprised to see it in the journal table and not derived from the user table. If it were the username, it would be redundant and not necessarily subject to update if the username were changed.
I only converted Brahm's vBindex version absolutely without modifying part of his code (I can't without explicit agreement).
Reply With Quote
  #24  
Old 10-18-2004, 02:19 PM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm at lesson now and I can't try...
...but at your own risk try this:


Code:
$getlateste= $DB_site->query("
            SELECT journal_entries.entrytitle,journal_entries.entrydate,
            journal_entries.entry_id,journal_entries.entrytext,
            journal_entries.journal_id,journals.journalist,journals.journalist_id
            FROM ".TABLE_PREFIX."journal_entries AS journal_entries
            LEFT JOIN ".TABLE_PREFIX."journals AS journals ON (journal_entries.journal_id=journals.journal_id)
            GROUP BY journal_entries.journal_id
            WHERE journal_entries.entry_active=1 AND journal_entries.private!=1 AND journals.private!=1
            ORDER BY journal_entries.entrydate DESC
            LIMIT 5
            ");
Reply With Quote
  #25  
Old 10-18-2004, 07:07 PM
billbensen billbensen is offline
 
Join Date: Sep 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Mumble... the error is in Billbensen modification of my add-on. I will send a mail to him to correct is code...
The typo is in the first part of the journalentries.php on the first post of this topic. I just carried it over when I made my changes. It's a free statement that really causes no harm, unless there were another call to that var. Just makes good coding sense to release them.

Bill Bensen
Reply With Quote
  #26  
Old 10-18-2004, 07:20 PM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In fact! ;-)
Reply With Quote
  #27  
Old 10-18-2004, 10:01 PM
billbensen billbensen is offline
 
Join Date: Sep 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The typo is from the original mod for vbindex. Both Bolas and I overlooked it. I think the strip slashes is a nice bit that was missed as well.

This hack is for [vB 3.0.3] - vB Journal for vBulletin 3.0.3(v1.0.0) and [vB 3.0.3] - vB Journal | vba CMPS module: latest entries

Below is the more blog like version of Bolas' mod. I am working on the RSS portion of this to make it even more "blog like". The entry title is 50 chars and the body of the entry is 150 chars and then the "more..." link to the entry.

Please note that this only shows the first jounalists' entries. On my site I only wanted my entries to appear on the front page. :glasses: You can change that by modifying the WHERE portion of the query "journals.journalist_id = 1" to whatever ID you wish to display or by removing it.

touch /path_to_your_forum_dir/modules/journalentries.php

PHP Code:
<?php 
// ######################### Latest Forum Topics ######################### 
$getlateste$DB_site->query("SELECT journal_entries.entrytitle,journal_entries.entrydate, 
journal_entries.entry_id,journal_entries.entrytext, 
journal_entries.journal_id,journals.journalist,journals.journalist_id, journals.commentcount
FROM "
.TABLE_PREFIX."journal_entries AS journal_entries 
LEFT JOIN "
.TABLE_PREFIX."journals AS journals ON (journal_entries.journal_id=journals.journal_id) 
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1 AND journals.private!=1 and journals.journalist_id = 1
ORDER BY journal_entries.entrydate DESC 
LIMIT 5 
"
); 
$countlatest$DB_site->num_rows($getlateste); 
$latestentrybits ""
if(
$countlatest>0

while(
$latest$DB_site->fetch_array($getlateste)) 

$latestentrydatevbdate($vboptions['dateformat'], $latest['entrydate'], 1); 
$latestentrytimevbdate($vboptions['timeformat'], $latest['entrydate']); 
exec_switch_bg(); 
if(
strlen($latest[entrytitle])>20

$latest[entrytitle]= "".substr($latest[entrytitle],0,50); 

if(
strlen($latest[entrytext])>150

$latest[entrytext]= "".substr($latest[entrytext],0,200)."<div class='smallfont'><a href='$vboptions[bburl]/journal.php?do=showentry&e=$latest[entry_id]' title='$latest[entrytext]'>more...</a>";

eval(
'$latestentrybits .= "' fetch_template('journal_latestentrybits') . '";'); 

$DB_site->free_result($latest); 

else 

$latestentrybits=$vbphrase['adv_no_entries']; 



eval(
'$home[$mods[\'modid\']][\'content\'] = "' fetch_template('adv_portal_latestjournalentry') . '";'); 

$DB_site->free_result($getlateste); 
unset(
$latestentrybits,$latest,$latestentrytime,$latestentrydate,$countlatest); 

?>

then create template 'adv_portal_latestjournalentry'


HTML Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
 <tr>
  <td class="tcat">
    <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('cmps_pagesmenu')"><img id="collapseimg_cmps_pagesmenu" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_cmps_pagesmenu].gif" alt="" border="0" /></a>
    <span class="smallfont"><strong>$vbphrase[adv_latest_journalentries]</strong></span>
  </td>
 </tr>
</thead>
<tbody id="collapseobj_cmps_pagesmenu" style="$vbcollapse[collapseobj_cmps_pagesmenu];text-align:$stylevar[left]">
$latestentrybits
</tbody>
</table>
<br />

Modify the journal_latestentrybits

HTML Code:
<tr>
<td class="$bgclass"><div class="smallfont">$latestentrydate </br><a href="$vboptions[bburl]/journal.php?do=showentry&e=$latest[entry_id]" ><b>$latest[entrytitle]</b></a> <br /></div></td>
<tr><td class="$bgclass"><blockquote><div class="smallfont">$latest[entrytext]</div></blockquote><span style="cursor:pointer" onclick="window.open('member.php?u=$latest[journalist_id]')">Posted by:&nbsp;$latest[journalist] </span>at <span class="time">$latestentrytime</span> ($latest[commentcount] comments)</td></tr>
</tr>
Now add 2 GLOBAL phrases:
$vbphrase[adv_latest_journalentries] = "Latest Journal Entries"
$vbphrase[adv_no_entries] = "No Journal Entries"



Then create a new module:
Module Title: Journal Latest Entries
File to include: journalentries.php
Active: yes
Column: center
Templates Used: adv_portal_latestjournalentry, journal_latestentrybits


Live example towards the bottom of the page. Surf this... photography

This also displays the number of comments next to the author and the time the entry was added.

Bill Bensen
Reply With Quote
  #28  
Old 10-19-2004, 08:18 AM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good work!

If you want another example of the same Bilbensen modification to Bolas CMPS conversion of the Brahm's vBindex Add-On (please, we need another '..ation' to become the longest hackname of this forum ) you can go to http://www.wellage.net
In my main page I used Billbensen mod to have a preview on the right side instead of a center block.
Reply With Quote
  #29  
Old 10-19-2004, 08:51 AM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bolas, unrelated to this hack, there is a problem with your rollup code. The Journal button rolls up another ON FOCUS module. I had this problem and found I had to use unique names in five places (wherever you have ...cmps_pagesmenu substitute ...cmps_pagesjournal) in your journal template, I believe there are 5 occurrences) I can't guarantee that is the CORRECT solution, but that is what I did (give each module a unique cmps_pagesNAME) and the rollups worked independently.

Regards,

Matt
Reply With Quote
  #30  
Old 10-19-2004, 06:46 PM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh... deh...
It was so..ehm... funny!

Thank you, I will correct it ASAP!
Reply With Quote
  #31  
Old 10-20-2004, 08:43 AM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

done.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07486 seconds
  • Memory Usage 2,377KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete