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)

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>";
}

?>



All times are GMT. The time now is 03:23 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.01080 seconds
  • Memory Usage 1,788KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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