Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-12-2016, 10:54 PM
gcombe74 gcombe74 is offline
 
Join Date: Feb 2016
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php mysql query to pull last x number of posts

I migrated from phpbb3 to vbulletin.. and I used to pull the last 30 posts from my site by post id..

and oddly I can do that in vbulletin as well but only the posts that imported...

so the question is this..I was pulling by postid or lastpost... its easy to tell that vb5 has gone away from postid...

but is there query that I can run in vb5 to do this? can someone help me figure out how to reconstruct the url for pulling the last x number just php and mysql query?

Thanks
Reply With Quote
  #2  
Old 03-13-2016, 02:43 AM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That won't be easy to do. All posts, threads, forums, categories, attachments, photos, galleries, private messages......you get the idea, are stored in the node table. Everything in vb5 is considered content. It is possible to do refining the query by contenttype, but may not be full proof. Might I ask what exactly you are trying to accomplish?

The reason you can still puul the last 30 by postid in vbulletin on imported posts is because your old post table still exists.
Reply With Quote
  #3  
Old 03-13-2016, 10:44 PM
gcombe74 gcombe74 is offline
 
Join Date: Feb 2016
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Replicant View Post
That won't be easy to do. All posts, threads, forums, categories, attachments, photos, galleries, private messages......you get the idea, are stored in the node table. Everything in vb5 is considered content. It is possible to do refining the query by contenttype, but may not be full proof. Might I ask what exactly you are trying to accomplish?

The reason you can still puul the last 30 by postid in vbulletin on imported posts is because your old post table still exists.


just on my main site I like to list the last 30, but most of my forums are closed so RSS wont build them. so I was just wanting to pull the topic, date, person posting so people can see what is being taked about in a quick glance. in phpbb3 you can deterime what is built in RSS locked or not.
Reply With Quote
  #4  
Old 03-14-2016, 01:14 AM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use a search module with a custom search string in it that gives all the new threads, posts and comments in chronological order starting with the newest to the oldest. It works relatively bug free since version 5.1.5. Here is the basic version. I can help you tweak it for your needs. It also displays results based on permissions so if the user is logged in and has access to the closed forums, those new posts will be displayed for them to view.

Code:
search?searchJSON={"date":{"from":"1"},"type":["vBForum_Gallery","vBForum_Link","vBForum_Photo","vBForum_Poll","vBForum_Text","vBForum_Video"],"sort":{"relevance":"desc"},"view":"","exclude_type":["vBForum_PrivateMessage"]}
To use it, create a new page in site-builder and add the search module to the page. Edit the search properties in the advanced edit section and replace the search string with this one. Name the page and set the url to whatever you want such as /activity. Now when you navigate to /activity, you will see a page similar to the activity stream in vb4. You can adjust the "date"{"from":1 to however many days you wish to yield more or less results. This module can also be dropped onto a regular page or the front page if you want and will do the same thing. It will auto format for the size column you drop it in.
Reply With Quote
Благодарность от:
MarkFL
  #5  
Old 03-14-2016, 08:01 PM
gcombe74 gcombe74 is offline
 
Join Date: Feb 2016
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that code worked well. thank you.

So answer me this.. what would have have to embed in my main site (outside the forum) to make it display it on web page outside my forum? I realize session info is needed just not sure how in VB5 if that can be or how to.
Reply With Quote
  #6  
Old 03-14-2016, 08:19 PM
shimei shimei is offline
 
Join Date: Feb 2015
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gcombe74 View Post
that code worked well. thank you.

So answer me this.. what would have have to embed in my main site (outside the forum) to make it display it on web page outside my forum? I realize session info is needed just not sure how in VB5 if that can be or how to.
Just curious, if I am understanding you right..... Wouldn't a RSS feeder on the other site work to list all the newest posts from RSS on your Vb 5 site?
Reply With Quote
  #7  
Old 03-15-2016, 12:53 AM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gcombe74 View Post
that code worked well. thank you.

So answer me this.. what would have have to embed in my main site (outside the forum) to make it display it on web page outside my forum? I realize session info is needed just not sure how in VB5 if that can be or how to.
This code can help you with that. For it to work, your cookie path has to be / in vb5. It will of course need other code, but this is the basis of viewing forum content outside the forums.

External Login Tutorial

Quote:
Originally Posted by shimei View Post
Just curious, if I am understanding you right..... Wouldn't a RSS feeder on the other site work to list all the newest posts from RSS on your Vb 5 site?
Nope, he wants his users with private forum access to be able to view the activity stream. The RSS only works for public forums.
Reply With Quote
  #8  
Old 03-16-2016, 12:18 AM
IggyP IggyP is offline
 
Join Date: May 2012
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ive tried this fix and some other things but still cannot get a basic display of recent content in the order it was updated....theres always a couple in the middle thats out of order...

the search modules are pretty confusing to start with in vb5 but then to not work idk what i can do but wait and pray they fix it

really all i want is one "topic view" style module with a list of latest topics, posts, and comments, then one "default style" module that includes all activity but pms....shouldn't be too hard right?

--------------- Added [DATE]1458114644[/DATE] at [TIME]1458114644[/TIME] ---------------

well...i kept messing with it....

this is the best string i found so far

Code:
{"last_visit":1,"type":["vBForum_Gallery","vBForum_Link","vBForum_Poll","vBForum_Text","vBForum_Video"],"channel":["1"],"sort":{"lastcontent":"desc"},"view":"topic","exclude_type":["vBForum_PrivateMessage"]}
i think my confusion may be a bug for if i add photo content, it basically breaks....takes out things that should be listed and dont have anything to do with photo content...could be other issues, but for my current content at least that seem to display it all in a proper chronology.

btw, another thing that bugs me and seems to come up about searches of recent activity is regarding confusion when members comments, or editing....wouldnt it be nice if above the members name on these results, is said last edited by, last commented by, or last posted by above names? yes...yes it would
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 09:28 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.04284 seconds
  • Memory Usage 2,243KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete