vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   vBulletin Blog - Blog Comments vBAdvanced CMPS (formatted) (https://vborg.vbsupport.ru/showthread.php?t=206103)

optrex 02-20-2009 10:00 PM

Blog Comments vBAdvanced CMPS (formatted)
 
1 Attachment(s)
Add blog comments to your portal !

One of the main problems with the vB blog module is its poor integration with the main forum. This module allows you to show the last 5 blog comments (number is configurable) in a module on your vba portal page. It displays a short version of the comment, the blog title, and the person who commented, with built in links to the commment, user profile and the blog post itself.

This was the first and is still the only blog comments module for vBAdvanced


Features
  • Comments will not display if they have not been approved.
  • Configurable number of comments
  • Includes smilies
  • Includes URL formatting
  • Allows for text format such as bold
  • Configurable word count in comments
Instructions
Click install
Download the attached zip file
Edit blog_comments.php and change the variables to allow connection to your database.
Upload blog_comments.php to your modules directory.


From your admincp - vba cmps
Add new module
PHP file
Title - call it what you want
Active - yes
File to include - blog_comments.php
Identifier - call it what you want
Initialize BB Code Parser - YES
Select clean file output
Link - choose either blog home or comments page as you wish
Save and add to the page of your choice, the module has been designed to be a center block on the basis that long URL titles will push the margins. You can however place it where you want.

28th Feb 2009 - VERSION 2
Version 2 has been completely re-coded to make install land confiuration simpler. Rather than 2 files, there is now only one. This must be installed in the modules folder.
Allows blog titles
Allows configurable word count to be displayed
Links to user profile, blog and comment included.
Made variable changes easier in file.


22nd Feb 2009
Version upgrade from https://vborg.vbsupport.ru/showthread.php?t=173381

Allows smilies
Allows URL's
Allows formatting [BBCODE] Bold etc

optrex 02-21-2009 10:28 AM

Working example at Midlands Weather Forum

Version 2: Upgrade path
Delete the 2 files previously used and start again with this new single file install.

Now added
Configurable word limit in latest comments
Blog titles and links to blog areas - profile, blog post, comment etc.


Instructions to display comments from specific category: https://vborg.vbsupport.ru/showpost....4&postcount=17

Instructions to display avatars if using vbseo: https://vborg.vbsupport.ru/showpost....7&postcount=25


enjoy :D

yotsume 02-21-2009 02:07 PM

I updated to this new fixed version and it works perfectly!

THANK YOU!!!!

Suggestion: You should change your description to say:

Quote:

This module allows you to show the last 5 blog comments (the amount is configurable)
Now all we need is a updated Latest Blogs module for vba to match the recent threads vba module and the blogs will be truly finally pimped!



macc 02-21-2009 03:46 PM

hello!

tried but works not ... what must change in comments.php (mean table prefix)?

my database have no table prefix - "FROM " . TABLE_PREFIX . "blog_text.." - what make here?

get comments in top of my cmps page .... ??

must be center block?

regards

macc

optrex 02-21-2009 06:35 PM

Hey Macc,

If its appearing at the top of the page, you need to select the clean output from within vba (as per vba instructions with any php module). This also means it must be working, so no need to change " . TABLE_PREFIX . " however you can remove it if you want (exactly what I put in bold)

You can place the block where you like, but long URL titles (not the length of the URL themselves) will push the margins, hence its been "designed" for center placement.

**Updated** to those who have already installed this version, there is no need to update, I just re-uploaded the file with some typo corrections in the comments.

BWJ 02-21-2009 09:29 PM

Thank you for this mod!... :)

1) Question/suggestion:

How about including the title and author of the blog entry? To make it easier for the viewer to see what the comment is all about.

Example from your homepage:

If we take the latest comment in this latest blog comment module

Comment by Stourbridge Weather
Thanks. The Snow was quite bad near you Dolly.


Suggestion 1A:

SW's Ski Trip to Italy by Stourbridge Weather
Comment by Stourbridge Weather
Thanks. The Snow was quite bad near you Dolly.


or like this - Suggestion 1B:

Comment by Stourbridge Weather in SW's Ski Trip to Italy by Stourbridge Weather
Thanks. The Snow was quite bad near you Dolly.


2) Question:

Is it possible to take advantage of the blog categories and only retrieve the information from entries from only one specific blog category (instead of all the categories as it is now)?

ArnyVee 02-22-2009 01:26 PM

BWJ, I agree with your suggestion about adding the title of the blog post. :D

Great job optrex! I'll be watching this one ;)

inciarco 02-22-2009 02:37 PM

Ideas: Can You Add 2 Options? :confused:

1. Option to Limit the Number of Characters Displayed on the Comment. (Imagine a Comment of 1,000 or more Characters to be Displayed on CMPS :eek:)

2. Option to Limit the Length of Words in the Comments. Very Big Words or Words that are not Separated would Break the CMPS Layout, so it'd be Good to be able to Limit that.

Good Improvements, Thank You For Sharing Them. :up:

:)

optrex 02-22-2009 11:20 PM

Quote:

Originally Posted by BWJ (Post 1750996)
Thank you for this mod!... :)

1) Question/suggestion:

How about including the title and author of the blog entry? To make it easier for the viewer to see what the comment is all about.

Example from your homepage:

If we take the latest comment in this latest blog comment module

Comment by Stourbridge Weather
Thanks. The Snow was quite bad near you Dolly.


Suggestion 1A:

or like this - Suggestion 1B:

2) Question:

Is it possible to take advantage of the blog categories and only retrieve the information from entries from only one specific blog category (instead of all the categories as it is now)?

Q1 - That's something I've tried to do before. I think it is possible, because vb does something similar in the "all blogs comments" pages. But as yet, I can't work it out with my basic php knowledge as the blog text table displays a blank title field for comments.

Q2 I will look into, but it may have to be a manual edit based on category id rather than name. I take it you are also thinking admin categories rather than user ones - or both?

optrex 02-22-2009 11:25 PM

Quote:

Originally Posted by inciarco (Post 1751462)

1. Option to Limit the Number of Characters Displayed on the Comment. (Imagine a Comment of 1,000 or more Characters to be Displayed on CMPS :eek:)

2. Option to Limit the Length of Words in the Comments. Very Big Words or Words that are not Separated would Break the CMPS Layout, so it'd be Good to be able to Limit that.

1) Good suggestion, I'll have a look.
2) This one I think is more difficult. Can you give a legit example that would break a center column positioning?

BWJ 02-23-2009 10:00 PM

Quote:

Originally Posted by optrex (Post 1751858)
Q1 - That's something I've tried to do before. I think it is possible, because vb does something similar in the "all blogs comments" pages. But as yet, I can't work it out with my basic php knowledge as the blog text table displays a blank title field for comments.

Okay... I thought there was a reason... :)

Quote:

Originally Posted by optrex (Post 1751858)
Q2 I will look into, but it may have to be a manual edit based on category id rather than name. I take it you are also thinking admin categories rather than user ones - or both?

Admin categories will be fine. I don't mind a manual edit. Optrex - thank you for looking into this... :up: It would really be great if you are able to do it.

optrex 02-27-2009 11:36 AM

Well it took me a while, But I have integrated the suggestions made above.

We now have word limits (better than character limits) for the number of words displayed and we also have the blog entry titles etc as requested. I have also re-written the code to be one file rather than the 2 previously. The variables are also clearer and easier to change. Install time is now less than 5 mins for a noobie :)

yotsume 02-27-2009 04:14 PM

You have a typo here:

$limit = 5; //replace 5 with the umber of comments

Should say: number

I will have to update again and give this new version a try.

Thanks for the much needed great work!

miloheckport 02-28-2009 01:26 AM

We are just getting our blog going and comments are not frequent. Can you code a version that displays Recent Blog Entries vs. Recent Comments. and if there is a recent comment display the comment

optrex 02-28-2009 01:51 AM

I have a mod that picks up new blog entries and puts them into your "new posts". See my signature. Otherwise I need to take a look and put something fresh together, I have some ideas in mind.

inciarco 02-28-2009 03:16 AM

Great Improvements, Congratulations. :up:

Thank You For Sharing Them. :up:

My Best Regards.

:)

optrex 02-28-2009 05:35 AM

Quote:

Originally Posted by BWJ (Post 1752725)
Admin categories will be fine. I don't mind a manual edit. Optrex - thank you for looking into this... :up: It would really be great if you are able to do it.

Here is the edit to list by a category

in the variables add the line

$category = x; //where x is the category id number found in your AdminCP

in line 35, find:
Code:

$query = "SELECT {$prefix}blog.blogid,
and AFTER add:
Code:

{$prefix}blog.categories,
then in line 38 find
Code:

AND {$prefix}blog_text.state = 'visible'
and REPLACE with:
Code:

AND {$prefix}blog_text.state = 'visible' AND {$prefix}blog.categories = '{$category}'
This should result in only comments from the category selected being displayed. Please let me know how you get on.

BWJ 03-02-2009 10:03 PM

Quote:

Originally Posted by optrex (Post 1756704)
This should result in only comments from the category selected being displayed. Please let me know how you get on.

Thank you for your hard work! With the default solution (all categories) it works very fine.

But if I try with the changes for a specific category:

Fatal error: Cannot redeclare shorten_string() in /home/xxx/public_html/forum/modules/blog_comments.php on line 18

optrex 03-03-2009 07:02 AM

Quote:

Originally Posted by BWJ (Post 1758842)
Thank you for your hard work! With the default solution (all categories) it works very fine.

But if I try with the changes for a specific category:

Fatal error: Cannot redeclare shorten_string() in /home/xxx/public_html/forum/modules/blog_comments.php on line 18

I've changed the code in the above post. I had a stray , and category should have been categories. Tested and working 100%. Om the additional variable, don't forget the ;

BWJ 03-03-2009 09:44 AM

Sorry doesn't work for me. I have tried for 1? hour now:

Now I get this error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in [path]/modules/blog_comments_cars.php on line 31
I cannot connect to the database

I am 100% sure the password is correct - as I use it with success with e.g. your default version. This is the code I use with your changes:

PHP Code:

<?php
// I spent a while on this please leave the next couple of lines intact
// Coded by Optrex @ www.midlandsweather.org.uk
// Please do not put this onto any other site for download unless permision 

has been granted by myself (Optrex)
// This script is copyright www.midlandsweather.org.uk 

//variables to change below
$database database//replace xxx with the name of your 

database$username username//replace xxx with your database 

username$password password//replace xxx with your database 

password$wordcount 50//replace 50 with the number of words you want to 

have in your comments until cut off with ....
$website "http://xxx.com/forum/blog.php"//full website URL to your 

blog .php file including http
$prefix 
forum//table prefix - IF YOU DONT  HAVE ONE USE '' INSTEAD OF vb
$category 16//where x is the category id number found in your AdminCP
$limit 5//replace 5 with the umber of comments you want to show
//end of variables

function shorten_string($string$wordsreturned)
{
        
$retval $string;      //      Just in case of a problem
        
$array explode(" "$string);
        if (
count($array)<=$wordsreturned)
        {
                
$retval $string;
        }
        else
        {
                
array_splice($array$wordsreturned);
                
$retval implode(" "$array)."....read more";
        }
        return 
$retval;
}

$link mysql_connect ("localhost""{$username}""{$password}") or die("I 

cannot connect to the database"
);
mysql_select_db ("{$database}");
$query "SELECT {$prefix}blog.blogid, {$prefix}blog.categories, 

{$prefix}blog_text.title, {$prefix}blog_text.blogtextid, 

{$prefix}blog_text.userid, {$prefix}blog_text.username, 

{$prefix}blog_text.state, {$prefix}blog_text.pagetext, {$prefix}blog.title AS 

title2  "
.
 
"FROM {$prefix}blog, {$prefix}blog_text ".
    
"WHERE {$prefix}blog.blogid = {$prefix}blog_text.blogid AND 
{$prefix}blog_text.title = '' AND {$prefix}blog_text.state = 'visible' AND 
{$prefix}blog.categories = '{$category}'
ORDER BY 
{$prefix}blog_text.dateline desc
LIMIT 
{$limit}";
$result mysql_query($query) or die(mysql_error());
while(
$row mysql_fetch_array($result)){
$longcommentshorten_string($row['pagetext'],$wordcount);
$comment$bbcode_parser->do_parse($longcomment1,1,1,1);
    echo 
"<tr><td class=\"$bgclass\" align=\"left\"><span 

class=\"
{$Style['small']}\"><a 

href=\"
{$website}/member.php?u={$row['userid']}\">{$row['username']}</a>";
    echo 
" Made a ";
    echo 
"<a 

href=\"
{$website}/blog.php?bt={$row['blogtextid']}\">comment</a>";
    echo 
" in " 
    echo 
"<a 

href=\"
{$website}/blog.php?b={$row['blogid']}\">{$row['title2']}</a><br />";
    echo 
$comment" in " 
    echo 
"<a 

href=\"
{$website}/blog.php?b={$row['blogid']}\">{$row['title2']}</a>";
    echo 
"<br /></td></tr>";
}

?>


optrex 03-03-2009 07:17 PM

I'll PM you the code/file with the parts inserted. Make sure you use notepad, not word or wordpad for editing as it looks like you have returns and extra spaces all over, that or there is a wordwrap issue or something.

The only other notes I can see that are worth mentioning is that the website url should stop as follows

$website = "http://xxx.com/forum";

and is your database table prefix really forum?
$prefix = forum;

BWJ 03-04-2009 07:48 PM

Thank you very much for your superb support!

First of all the code you sent me works!

One interesting note is that the initial error message I received after implementing your original specific category code (before the code from you pm) was:

Fatal error: Cannot redeclare shorten_string() in /home/xxx/public_html/forum/modules/blog_comments.php on line 17

Then I think I messed with things too much (as you said it works 100%) Then I suddenly got the new error message I wrote about:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in [path]/modules/blog_comments_cars.php on line 31
I cannot connect to the database


Probably due to the messing around.
Okay, then I used the code you sent me by pm and then I receive the same error as initially:

Fatal error: Cannot redeclare shorten_string() in /home/xxx/public_html/forum/modules/blog_comments.php on line 17

Then I found out I had two instances of your mod on the same cmps page - one with blog_comments.php and one new file for the specific category blog_comments_cars.php

Then I removed the "get all blog comments" file: blog_comments.php

And then it worked! :D

Thank you again! I am sure other people will find this mod interesting.

PS: yes it is forum :-)

optrex 03-06-2009 06:21 AM

Excellent, glad you are all sorted.

PS if anyone has vbseo, then it makes adding the avatars easy ;)

goxy63 03-09-2009 03:22 AM

How to disable shown images in this module !?
And pls few words about user avatars infront of comment

Thanks

optrex 03-09-2009 08:22 AM

To remove images you would need to change
Code:

$comment= $bbcode_parser->do_parse($longcomment, 1,1,1,1);
to
Code:

$comment= $bbcode_parser->do_parse($longcomment, 0,1,1,0);
I've not tested this but basically the first 0 turns off html and the last 0 turns off image code. Please try it and feedback.

VBSEO for avatars:

My avatars are in the format url/avatars/username.gif?datelinestamp
I can use this method, due to the fact that usernames are unique.

The code I use on the hack is
Code:

<img align=\"absmiddle\" src=\"{$website}/avatars/{$row['username']}.gif\" width=\"30\" height=\"30\"></img>
place is where you want the avatar to show

goxy63 03-09-2009 12:13 PM

Just changed code regarding to images, works like charm

But I think with avatars I dont have much luck, its on my side for shure as Iam noobish to all this

I have installed VBSEO for my forums, free version...I guess I should install addon for CMPS in order that this avatr thing work out for me

Thank you very much for this mod

optrex 03-09-2009 06:09 PM

AFAIK there is not a free version for VBSEO, unless you are on about the sitemaps generator, which is not the same thing.

goxy63 03-09-2009 09:44 PM

:)
Yes my mistake .... was thinking about sitemap generator

Thanks again for great mod

joerns 03-11-2009 07:34 PM

I've followed the installation instructions but get a blank page at the moment. I've checked my variables, and they seem to correspond with those in the config.php file. Any ideas?

optrex 03-12-2009 12:16 AM

You need to click install for support
but to point you in the right direction
http://www.theshebeen.org/blogs/ has no blog comments displaying either :p

goxy63 03-22-2009 05:50 AM

Hi
I got probem when comment link is clicked from CMPS homepage, user is redirected to blogs but they got '...forums/blog.php/blog.php'
Note that it says two times 'blog.php'....than I got trouble with images navbar and stuff

Any suggestions

Thanks for this nice hack, very usefull for my homepage

Regards
Goran

optrex 03-22-2009 09:00 AM

Line 7, your website should be in the format

Code:

$website = "http://www.domain.net"; //full website URL including http
not
Code:

$website = "http://www.domain.net/forum/blog.php"; //full website URL including http

goxy63 03-22-2009 06:09 PM

Thanx that resolved my problem

Cheers

dpnow 06-26-2009 09:48 AM

I have installed this and it's at the bottom of our forum portal page here:

http://dpnow.com/forum2/cmps_index.php

But I have to say the formatting is not very inspiring - can anyone point me in the right direction for making it present itself more like the Recent Threads module output above on that page?

How would you improve it if it was your site?

Ian

yotsume 07-01-2009 08:28 PM

I have the latest version of the blog installed and I am trying to get this single file version of the blog comments installed. However, I get the following error message:

Parse error: syntax error, unexpected T_STRING in /homepages/xx/xxxxxx/htdocs/xxxx/modules/blog_comments.php on line 10

Line 10 of your code is asking for the database password.

What I notice in this single file is there is no database option for inputing the "Server Name". My host doesn't use "Localhost" for this.

Anyway how can I fix this error?

THANKS!

yotsume 07-01-2009 08:52 PM

I was able tofix your module by making manual edits to include my database info.

Also, you have the default table prefix as vb and it is usually always vb_. So people will get an error with the prefix set as vb only.

I fixed your file this way:

1. I had to comment out
//$database
//$username
//$password

2. I had to manually edit and input my database info like this:

Code:

$link = mysql_connect ("xxxx.perfora.net", "dbxxxxxxxx", "pwxxxxx") or die("I cannot connect to the database");
mysql_select_db ("dbxxxxxxx");

Now that I manually edited your file it works fine. I believe you have a number of errors in your current zip file.

Chimpie 07-03-2009 01:21 AM

The only thing I would like to see added to this (unless I'm missing it here) is a way to add Entries to the list, not just comments.

peleh 07-03-2009 07:25 AM

i'm running wordpress + vbulletin + vbridge, does this mod work on wordpress?

Dstephan 07-07-2009 03:33 AM

Quote:

Originally Posted by Chimpie (Post 1841746)
The only thing I would like to see added to this (unless I'm missing it here) is a way to add Entries to the list, not just comments.

I'd like this too - I don't really want comments on my front page, but having links to actual blogs would be great.

yotsume 07-07-2009 03:57 AM

There is a separate cmps mod for showing blogs entries.

So far no blog mods are properly formatted.

We need blog mods formated to match how nice vba recent threads block looks!

Its shocking that no one has created a proper blog mod yet for vba. :(


All times are GMT. The time now is 05:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03513 seconds
  • Memory Usage 1,888KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (1)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete