vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   php mysql query to pull last x number of posts (https://vborg.vbsupport.ru/showthread.php?t=322098)

gcombe74 03-12-2016 10:54 PM

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

Replicant 03-13-2016 02:43 AM

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.

gcombe74 03-13-2016 10:44 PM

Quote:

Originally Posted by Replicant (Post 2567102)
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.

Replicant 03-14-2016 01:14 AM

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.

gcombe74 03-14-2016 08:01 PM

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.

shimei 03-14-2016 08:19 PM

Quote:

Originally Posted by gcombe74 (Post 2567217)
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?

Replicant 03-15-2016 12:53 AM

Quote:

Originally Posted by gcombe74 (Post 2567217)
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 (Post 2567218)
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.

IggyP 03-16-2016 12:18 AM

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 :p


All times are GMT. The time now is 07:35 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.01897 seconds
  • Memory Usage 1,736KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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