Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 04 Dec 2009, 17:10
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
str replace into forumhome_forumbit_level2_post

I have read the other threads about this but none had helped me.

I have added an option in the editing/creating a forum page. My option variable is $forum[var].
When I place the variable {vb:raw forum.newoption} directly into forumhome_forumbit_level2_post it works, it displays the data.
So I'm trying to do this via plugin with the following code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The plugin works, but I get the variable outputted, not the data that is storing.

After this, I did try using a template, with the variable in it. Then I registered and rendered the template y used that to str replace.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This works, but outputs the same data for each forum, even if I just inserted some values in my option in only one forum.

I must say that I'm new creating plugins, maybe I'm missing something.
Reply With Quote
  #2  
Old 04 Dec 2009, 17:15
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

is for templates not plugins.


It would be more like the following:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #3  
Old 04 Dec 2009, 17:58
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
That works as my template approach.
The variable ouput get repeated into the next forum, even is the next has its own value. The second forum shows its value, but the value from the previous forum.

I'm looking into the vBulletin files to see how they do that, I'm not good at this but i'm learning
Reply With Quote
  #4  
Old 04 Dec 2009, 18:08
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
can you paste more of your code

Did you set your own variable for $forum or $forum[newoption]

I am not totally understanding what it is you want to do. I think you want to grab the postid for each post.

add this in your code towards the bottom:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Tell me the output that shows above the header.
Reply With Quote
  #5  
Old 04 Dec 2009, 18:16
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
You probably need to zero it out prior to setting it. That way, if you don't set it for that particular forum, it won't show the previous setting.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #6  
Old 04 Dec 2009, 18:35
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
$forum[newoption] is from the options when editing a forum. I've added a new option there:

hook: forumadmin_edit_form

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I then validated the data:
hook: forumdata_start

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I also added a iconlocation field to the forum table in my database. That part works as spected. It saves the data.

Now using the variable directly into my template it works as spected too: $forum[iconlocation] as {vb:raw forum.iconlocation}

The problem is trying to insert that variable using a plugin:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I've attaced a screenshot so you can see what i'm talking about.

Also the output for var_dump($forum[iconlocation]); is

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Attached Images
File Type: png 12-4-2009 2-32-07 PM.png (17.2 KB, 16 views)
Reply With Quote
  #7  
Old 04 Dec 2009, 18:53
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
try this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

you can remove this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #8  
Old 04 Dec 2009, 19:42
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
No, that isn't the problem. If I use that I get printed the variable names, not the data.

Thank you for your help, I'm going to release the plugin as it is, and ask the user to make a template edit to insert the html code. I can't make it work.
Reply With Quote
  #9  
Old 04 Dec 2009, 22:27
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
When you release it I will take a look and see if I cant make it work the way you want.
Reply With Quote
  #10  
Old 04 Dec 2009, 22:52
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
It's been released. Actually without automatic template edit the product is useless since the same icon can be added into the forum description without having to modify templates

http://www.vbulletin.org/forum/showthread.php?p=1925448
Reply With Quote
  #11  
Old 05 Dec 2009, 01:31
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Well after looking whats wrong with a template?

Just do a auto template with in the xml file.
Reply With Quote
  #12  
Old 05 Dec 2009, 10:43
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Real name: Matthew Gordon
Here's an example of how I do it. Not sure what issues your code is having.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Essentially, call your template using vB_Template::fetch_template_raw('templatename') - that way it pulls the raw code needed to be eval'd at the end. If you do it that way, it shouldn't fail. Good luck.
__________________
Along with Zachery, I make releases as GeekyDesigns. Please do not PM or IM me for support.

Last edited by Link14716; 05 Dec 2009 at 10:51.
Reply With Quote
  #13  
Old 06 Dec 2009, 00:04
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Hey Elmer sorry it took so long been busy.

Here is what you are looking for:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Make a plugin with the hook location process_templates_complete
I named mine "Forum Icon Template Replacement"

Put the code from above in there.

Be advised there is no if statement so it shows for every forum even if there is no icon in place I left that for you to do.
Reply With Quote
  #14  
Old 06 Dec 2009, 21:08
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
Thaks BBR, I will try again, I'll let you know if it works.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 02:21.

Layout Options | Width: Wide Color: