Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Pull specific forum into post
Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 20, 2013 - 2:46 pm

I was wondering if someone could give me a heads up or a pointer about pulling a specific forum into a post.

We have a setup (based on membership levels) that allows people to view certain posts based on their level.  Many of these posts are directly associated with a private forum (also accessible based on membership level).  We want to pull the private forum into the post, so while someone is watching the video within the post, they can view questions (and maybe ask their own) that are related to the video they are watching.

Just curious if there's some way I can do this within the theme files, or by using a shortcode?  I can write it myself, but I just wanted to know what I needed to look for, as far as hooks go.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 20, 2013 - 7:06 pm

specific forum into a post??  you want the whole forum?  or just recent posts?  there is no way to have a forum displayed on a page by itsef... but using the recent post template function, you can pull in the last X posts from that forum...  and they will link to the actual forum...

Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2013 - 9:21 am

The setup of the site is kind of complicated :)  basically, the end user logs in, and purchases a course.  Upon successful purchase, they can access the course videos.  (Right now, these are displayed in a custom post type.) The courses also come with access to private forums that go along with the course.

The client wants me to pull in the private forum (that goes with the course) into the pages with the course videos.  So while someone's watching the course video, they can look through the forums that go along with the course, and view previous posts or add their own right on that page. (as an example, if you visit http://udemy.com, you'll see exactly what I'm talking about.)

I wasn't sure it it was possible to just pull in a single forum into a post using template tags, or if it was more realistic to do something like, say, do a popup window that has the video on one side and uses an iframe to pull the forum into the other.  I'm thinking the iframe solution might be what's needed - but if I do that, I don't want to allow the end user to back up out of the forum and switch to a different one.

Alternatively, if there's some kind of method where I could just create a form, so if the end user posts something with that form it'll get posted directly into the forum in question, that would be good, too.  I have Gravity Forms, so that;s possible - but I'd need to know what hooks to use to make the content post into the forum without actually *being* on the forum page.

 

 

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 21, 2013 - 9:55 am

No - afraid it is not possible to create a working instance of a specific forum into another page. The iFrame might work though...

The form question is doable if you need to go down that route. I am racking my brains for gotchas but I think it would be just a matter of (a) setting up the necessary POST variables and hooking the form action to the correct file (/forum/library/sp-post.php). We can certainly advise on what would be needed in more detail.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2013 - 10:55 am

I'll look into the plugin code, but yes, please - if you can provide me with hooks and/or what $_POST info I'd need, that would be great.  I'm pretty good at bending Gravity Forms to my will - I just need to know what to hook into to make the end result good.  That would be preferable to an iFrame (but you gotta do what you gotta do, I guess :) )

Thanks :)

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 21, 2013 - 11:57 am

I think the basic set (and I will check some more later) would be - for a new post in an existing topic:

forumid
forumslug
topicid
topicslug
action = 'post'
postpin = false
guestname = empty
guestemail = empty
editTimestamp = false
postitem

These would be the actual POST variable names. The first four speak for themselves I think. The next five can be set as shown. The last one 'postitem' needs to contain the actual post text.

The form action would have to be the php file as I specified above.

You can always take a look at the file /forum/content/forms/sp-form-post.php for the basics. That is the display code for the new post in existing topic data entry form.

Now - if instead you want adding a new topic then shout - you will need one or two additional items.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2013 - 12:52 pm

Thanks! That's really helpful!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 21, 2013 - 1:53 pm

Just shout if you need any help.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625