vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Any way to display or print list of forum id's (https://vborg.vbsupport.ru/showthread.php?t=195768)

nanaimobar 11-08-2008 06:45 PM

Any way to display or print list of forum id's
 
Is there any simple way to display or print list of forum id's? The reason I ask is that some mods require forum id's or other pertinent data which would be easy to input if one had a printout or a text file for reference.

Maybe I'm dumber than a store-full of Stanley hammers but the only way I can get forum id's from within the Admincp is to manually open each forum or sub-forum.

Any suggestions greatly appreciated.

mikewastaken 11-08-2008 07:41 PM

On your forumhome, if you hover over one of the link's, it should say something like this :

http://www.yoursite.com/forumdisplay.php?f=9

9 is the id

That's the quick way of being able to see your categories ID

nanaimobar 11-08-2008 07:56 PM

Quote:

Originally Posted by mikewastaken (Post 1661951)
On your forumhome, if you hover over one of the link's, it should say something like this :

http://www.yoursite.com/forumdisplay.php?f=9

9 is the id

That's the quick way of being able to see your categories ID


It's not that I can't see them or can't find them easily enough by clicking through the AdminCP Forum Manager, but rather that I would like a way to print out a list of forum and sub-forum id's.

Some sites may have a large number of forums and sub-forums and having a way to print-out a list of id's would perhaps make life a little easier for them.

mikewastaken 11-08-2008 08:22 PM

You could make a mysql query something like :

$result = mysql_query("SELECT forumid, title FROM forums order by forumid desc");

while($row = mysql_fetch_array($result))
{
echo "ForumID=".$row['forumid'] . " " . $row['title'];
echo "<br />";
};

It would come up like

ForumID=1 My First Forum
ForumID=2 My Second Forum
ForumID=3 My Third Forum

This way also, your mods could load the page up and see it themselves, and if anything changes, the script changes obviously.

nanaimobar 11-08-2008 08:34 PM

Quote:

Originally Posted by mikewastaken (Post 1661971)
You could make a mysql query something like :

$result = mysql_query("SELECT forumid, title FROM forums order by forumid desc");


while($row = mysql_fetch_array($result))
{
echo "ForumID=".$row['forumid'] . " " . $row['title'];
echo "<br />";
};


It would come up like

ForumID=1 My First Forum
ForumID=2 My Second Forum
ForumID=3 My Third Forum



This way also, your mods could load the page up and see it themselves, and if anything changes, the script changes obviously.

Mikewastaken, when I click on the Execute SQL Query link in the AdminCP I get a message indicating "You are not authorized to execute SQL queries".

mikewastaken 11-08-2008 08:53 PM

in your include/config.php file, find the following


Code:

        //        ****** USERS WITH QUERY RUNNING PERMISSIONS ******
        //        The users specified here will be allowed to run queries from the control panel.
        //        See the above entries for more information on the format.
        //        Please note that the ability to run queries is quite powerful. You may wish
        //        to remove all user IDs from this list for security reasons.
$config['SpecialUsers']['canrunqueries'] = '';

Usually the first person is admin, which is you. So put in '1'.

nanaimobar 11-08-2008 09:09 PM

Quote:

Originally Posted by mikewastaken (Post 1661978)
in your include/config.php file, find the following


Code:

        //        ****** USERS WITH QUERY RUNNING PERMISSIONS ******
        //        The users specified here will be allowed to run queries from the control panel.
        //        See the above entries for more information on the format.
        //        Please note that the ability to run queries is quite powerful. You may wish
        //        to remove all user IDs from this list for security reasons.
$config['SpecialUsers']['canrunqueries'] = '';

Usually the first person is admin, which is you. So put in '1'.

Hi mikewastaken,

Changed config - which worked like a charm - but when I ran query I got this error:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$result = mysql_query("SELECT forumid, title FROM forums order by forumid desc")' at line 1

The mysql version running the site is 4.1.22
and core tables haven't been changed. Site is running vbulletin 3.7.4.

BigJohnny 11-08-2008 09:45 PM

because that code isnt an sql query... i believe its a php script that needs to be run from vbulletin?!?!

you would need to add some includes i think, like global.php but im not sure about this, so i'll wait until someone who knows steps in :)

Lynne 11-08-2008 10:35 PM

Just open a text editor, and put in (small change in query from above since the name of the table is 'forum', not 'forums'):
Code:

<?php

require_once('./global.php');

$result = mysql_query("SELECT forumid, title FROM forum order by forumid desc");


while ($row = mysql_fetch_array($result))
{
echo "ForumID=".$row['forumid'] . " " . $row['title'];
echo "<br />";
};

?>

Save as whatever.php, upload via ftp, and point your browser to it and it will spit it all out. Change 'desc' to 'asc' if you wish it to be in ascending order instead.

nanaimobar 11-08-2008 10:36 PM

Quote:

Originally Posted by BigJohnny (Post 1661998)
because that code isnt an sql query... i believe its a php script that needs to be run from vbulletin?!?!

you would need to add some includes i think, like global.php but im not sure about this, so i'll wait until someone who knows steps in :)

The code I should have quoted for the mysql query is:

$result = mysql_query("SELECT forumid, title FROM forums order by forumid desc");


while($row = mysql_fetch_array($result))
{
echo "ForumID=".$row['forumid'] . " " . $row['title'];
echo "<br />";
};

_______
The error reported by vbulletin - in previous post - when running the "Execute SQL Query" from AdminCP is for the first line:
$result = mysql_query("SELECT forumid, title FROM forums order by forumid desc");

cstreater 09-12-2011 01:45 PM

Quote:

Originally Posted by Lynne (Post 1662018)
Just open a text editor, and put in (small change in query from above since the name of the table is 'forum', not 'forums'):
Code:

<?php

require_once('./global.php');

$result = mysql_query("SELECT forumid, title FROM forum order by forumid desc");


while ($row = mysql_fetch_array($result))
{
echo "ForumID=".$row['forumid'] . " " . $row['title'];
echo "<br />";
};

?>

Save as whatever.php, upload via ftp, and point your browser to it and it will spit it all out. Change 'desc' to 'asc' if you wish it to be in ascending order instead.

Lynne thank you so much for this. I administer a high traffic site with 300 device forums. Finding the forum ID's when I need them is a nightmare without this. I used the code above and added your advice from another thread that limits access to Admins only.

I also want to figure out two more things 1) display the forum URL's 2) We also have a bunch of forums that are now hidden and link to others. I'd rather not see these in the list and would like to either identify them as forums that meet this criteria of filter them from the list.

I'm determined to figure this out on my own, but if you happen to read this and know the answer, I'll take whatever info you can provide.

BTW: A message displayed that "I couldn't like your post" but I do. Just wanted to let you know that it wouldn't let me.


All times are GMT. The time now is 04:11 AM.

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.01282 seconds
  • Memory Usage 1,750KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete