vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Creating Addons (https://vborg.vbsupport.ru/showthread.php?t=314198)

ozzy47 09-29-2014 08:46 PM

Just compare your version to mine. :) It was not much of a change.

Black Snow 09-29-2014 08:58 PM

Uploaded it and it doesn't work for me lol

ozzy47 09-29-2014 09:00 PM

Are you sure the post is moderated?

ozzy47 09-29-2014 09:01 PM

Wait, I had the template edit in, give me a bit.

Black Snow 09-29-2014 09:01 PM

I unapproved the post and it shows Moderated Post next to the post ID

ozzy47 09-29-2014 09:08 PM

Ok give me a bit to work it out.

ozzy47 09-30-2014 12:26 AM

I am getting close on this. Had to completely re write the regex for the replacement.

Now I just have to get the css to get in place.

Black Snow 09-30-2014 06:59 AM

I didn't think it would be that hard to use the str_replace function. It looks easy enough when looking at other mods/articles.

Black Snow 09-30-2014 10:01 AM

OK cool. Thanks very much ozzy.

Why is it so hard to do a str_replace on that div?

Black Snow 09-30-2014 10:02 AM

Not sure how my post just inserted itself before yours although I was replying to you lol. And how did you post at 12:07 when vB states its 12:02 at the bottom of the page?

ozzy47 09-30-2014 10:07 AM

The issue is what we are trying to replace with. I had looked into this just about a year ago and failed. I have just about got it right as of now, but I neet to test it against other mods to make sure it won't break them.

So hopefully later today I will have this ready. :)

Black Snow 09-30-2014 10:40 AM

I did reply to you ozzy but the posts went above your last post for some reason.

Black Snow 09-30-2014 11:33 AM

Haha! Something wrong with vB then.

Well at least your getting something out of helping me. Be nice to have all your temp mods as real mods.

ozzy47 09-30-2014 11:39 AM

Who knows what's going on with the post times. :confused: I noticed it happen yesterday as well.

As for the str_replace it is difficult because of what we are adding, it needs to be done while the template is being compiled, but I got it working, so I should have this ready for you later today.

Good thing is now I can redo my template modifications, that did something similar and turn them into real mods. :)

Black Snow 09-30-2014 12:02 PM

After an addon is made and you are testing it, how can you test what the output is? Can you use print or echo to see the output of your code?

ozzy47 09-30-2014 09:28 PM

Ok here it is.

I added the stylevar for the background also for you.

ozzy47 09-30-2014 10:15 PM

There is one change you need to make th the CSS template. Remove what is in there and replace it with this:

Code:

.postbitlegacy .postbody_moderated, .eventbit .eventdetails .eventbody {
    margin-{vb:stylevar left}: {vb:stylevar postbitlegacy_userinfo_width};
    border-{vb:stylevar left}: {vb:stylevar postbit_userinfo_border};
    background: {vb:stylevar mod_post_background_color};
    padding-bottom: -1em;
}

I forgot I had some of the values hard coded for testing.

Black Snow 10-01-2014 06:56 AM

1 Attachment(s)
Still nothing happening for me when I install it and make the changes. I think I also need to make the settings for the background colour as there is only the setting to enable the mod.

You can see on the attached image that the post is moderated and the div class is still postbody.

ozzy47 10-01-2014 09:00 AM

Wierd, it should be showing as moderated. Care to send me a admin account so I can see what is going on?

ozzy47 10-01-2014 09:32 AM

I just tested this on a vanilla vB4 site and it is working, so I would need to debug what is going on with your site that is stopping the mod from working.

Black Snow 10-02-2014 06:36 AM

How do I go about debugging to find the cause of the problem?

ozzy47 10-02-2014 09:17 AM

Not sure, depends on alot of different variables.

Black Snow 10-02-2014 09:34 AM

Quote:

Originally Posted by ozzy47 (Post 2517179)
Wierd, it should be showing as moderated. Care to send me a admin account so I can see what is going on?

PM sent.

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

I installed the mod again and for some reason it now changes the postbody class to postbody_moderated. Not sure why it's working now or what happened. But it now need the CSS to work.

ozzy47 10-02-2014 09:04 PM

This has been fixed on the users site.

Black Snow, make sure you change the CSS in the master style to what I mentioned earlier.

Code:

.postbitlegacy .postbody_moderated, .eventbit .eventdetails .eventbody {
    margin-{vb:stylevar left}: {vb:stylevar postbitlegacy_userinfo_width};
    border-{vb:stylevar left}: {vb:stylevar postbit_userinfo_border};
    background: {vb:stylevar mod_post_background_color};
    padding-bottom: -1em;
}

Or export the current XML, make the change, then re import.

Black Snow 10-03-2014 08:24 AM

Thanks again ozzy. I am trying to make new stylevars for the mod. When I fill in all the boxes, select the product and click save, I get this error:

Quote:

A required field called product is missing or has an invalid value.
Any idea what it means or why it's happening?

ozzy47 10-03-2014 09:09 AM

Not sure, can't say I ever came across that before.

Black Snow 10-03-2014 09:14 AM

It works fine most of the time but now and then it pops up with that error and I can't add a stylevar to the product.

ozzy47 10-03-2014 09:20 AM

Try disabling hooks via includes/config.php and try again.

Black Snow 10-03-2014 09:41 AM

Quote:

Originally Posted by ozzy47 (Post 2517530)
Try disabling hooks via includes/config.php and try again.

Still get the same error. I had it before and I had to delete the product and make it again from scratch.

ozzy47 10-03-2014 09:45 AM

Has to be something on your site, I just tried to add another stylevar to the mod and was successful.

ozzy47 10-03-2014 10:18 AM

Anything in the error logs?

Black Snow 10-03-2014 10:29 AM

It's not the mod you helped with, it's a fresh mod I'm making stylevars for.

ozzy47 10-03-2014 11:40 AM

If you pm me the XML file on my site, I can look at it later today.

Black Snow 10-03-2014 11:48 AM

Quote:

Originally Posted by ozzy47 (Post 2517543)
If you pm me the XML file on my site, I can look at it later today.

I will later. Does this look OK? I am wanting to make an option to choose whether links are underlined or not when hovered over. I have made the option for the mod and if selected yes, then links will be underlined. If selected no, they won't be.

Code:

if ($vbulletin->options['url_active']) {

if ($vbulletin->options['url_text_decoration']) {
  $decoration = 'underline';
}else{
  $decoration = 'none';
}
}


vB_Template::preRegister('url.css',array('decoration' => $decoration));

Then in url.css I have this:
Code:

        text-decoration: $decoration;

Black Snow 10-14-2014 09:12 AM

How do I go about adding a setting from a mod into a plugin?

I want to add an input box into my mod which an admin can enter a URL or name etc, then have the setting output the value via a plugin.

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

I know I can add this to a template:
Code:

{vb:raw vboptions.this_settings}
But I wondered if I can also add it into a plugin or is there a different way to do it?

I suppose I would be better off creating a template, putting my code inside it, then running a plugin to call the template to insert it inside the showthread template?

ozzy47 10-14-2014 11:32 AM

Kinda hard to say without 1, seeing your code, 2, knowing what it is you are trying to do and 3, knowing what the expected end result is desired.

Black Snow 10-14-2014 11:40 AM

Sorry, I was in the middle of making it work. I got it in the end. I am looking for your help ozzy, I will PM you my question.

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

Looking for a way to show all available forums so I can make my mod work on only chosen forums. Any tutorial about how to achieve this?

Black Snow 10-31-2014 08:56 AM

Is there a way to remove a chunk of code from a template using plugins? I know about the str_replace function but what about removing 20 lines from a template?

SHOWTHREAD template for example, how would I remove this:
Code:

<vb:if condition="$show['threadrating']">
                <li class="popupmenu" id="threadrating">
                    <h6><a class="popupctrl" href="javascript://">{vb:rawphrase rate_this_thread}</a></h6>
                    <div class="popupbody popuphover">
                        <form action="threadrate.php" method="post" id='showthread_threadrate_form'>
                            <ul>
                                <li id="threadrating_current"<vb:if condition="!$show['rating']">class="hidden"</vb:if> title="{vb:rawphrase thread_rating_x_votes_y_average, {vb:raw thread.votenum}, {vb:raw thread.voteavg}}"><label>
                                    <span class="rating r{vb:raw thread.rating}<vb:if condition="$thread['rating'] != 5">_{vb:stylevar right}</vb:if>">{vb:rawphrase current_rating}</span>
                                </label></li>
                                <vb:if condition="$show['ratethread']">
                                    <li><label for="r5"><span class="rating r5">
                                        {vb:stylevar dirmark}<input type="radio" name="vote" value="5" id="r5" {vb:raw votechecked.5} tabindex="20" /> {vb:rawphrase excellent}
                                    </span></label></li>
                                    <li><label for="r4"><span class="rating r4_{vb:stylevar right}">
                                        {vb:stylevar dirmark}<input type="radio" name="vote" value="4" id="r4" {vb:raw votechecked.4} tabindex="21" /> {vb:rawphrase good}
                                    </span></label></li>
                                    <li><label for="r3"><span class="rating r3_{vb:stylevar right}">
                                        {vb:stylevar dirmark}<input type="radio" name="vote" value="3" id="r3" {vb:raw votechecked.3} tabindex="22" /> {vb:rawphrase average}
                                    </span></label></li>
                                    <li><label for="r2"><span class="rating r2_{vb:stylevar right}">
                                        {vb:stylevar dirmark}<input type="radio" name="vote" value="2" id="r2" {vb:raw votechecked.2} tabindex="23" /> {vb:rawphrase bad}
                                    </span></label></li>
                                    <li><label for="r1"><span class="rating r1_{vb:stylevar right}">
                                        {vb:stylevar dirmark}<input type="radio" name="vote" value="1" id="r1" {vb:raw votechecked.1} tabindex="24" /> {vb:rawphrase terrible}
                                    </span></label></li>
                                    <li class="formsubmit"><input type="submit" class="button" value="{vb:rawphrase vote_now}" tabindex="25" /></li>
                                <vb:else />
                                    <li><label>{vb:rawphrase already_rated_this_thread}</label></li>
                                </vb:if>
                            </ul>
                            <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
                            <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                            <input type="hidden" name="t" value="{vb:raw threadid}" />
                            <input type="hidden" name="pp" value="{vb:raw perpage}" />
                            <input type="hidden" name="page" value="{vb:raw pagenumber}" />
                        </form>
                    </div>
                    <script type="text/javascript">
                    <!--
                        vB_AJAX_ThreadRate_Init('showthread_threadrate_form', {vb:raw threadinfo.threadid});
                    //-->
                    </script>
                </li>
            </vb:if>

I could use a plugin to render a new showthread template with my customisation but thought there may be a way to remove it from the original template?

ozzy47 10-31-2014 09:32 AM

Why remove or hide the code, just set the $show['threadrating'] to false.

Black Snow 10-31-2014 10:32 AM

Because I want use the etiket template mod to put the options above the thread.


All times are GMT. The time now is 01:02 PM.

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.01320 seconds
  • Memory Usage 1,841KB
  • 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
  • (6)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete