Announcement

Collapse
No announcement yet.

Complicated Postbit modification – help required.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Complicated Postbit modification – help required.

    I'm hoping someone can help with this.

    I have a large forum, which is also a car club. Paying members have extra abilities on the site. One of these abilities allows them to post a specification of their car in the "Members Cars" forum along with attachments.

    I have a custom profile field with asks what car they have. This is then shown on the postbit so that people don't have to state which car they have when asking technical questions. This is something that works with regular users as well as club members. The code I have added to the post bits template is below:

    <if condition="$post['field5']"><div>Drives: $post[field5]</div></if>

    I plan to enhance this slightly. As the Club users have a full spec of their car in the Members Cars forums, I would like to link directly to this from the postbit.

    I will create another profile field asking for the URL (or maybe post number) of their car's specification. Let’s assume this as being "field6"

    I could then add this to the postbit templates:

    <if condition="$post['field5']"><div>Drives: <a href= "$post[field6]">$post[field5]</a></div></if>

    But - this will show a link even if they have added no link. Plus - this will also try to add a link to those who are not club members.

    This is where it gets complicated.... I need to do this:

    If the user is a club member, moderator, admin - show what car they have if they have filled this in [field5] in the postbit and if they have a specification [field6] have this link to it [by clicking field5].

    If the user is not in one of the above user groups (i.e. registered users) show what car they have if they have filled this in [field5] but do not show a link, even if they have added one in their profile.


    I hope this all makes sense and that someone can help me with this.

    Many thanks in advance.

    Mike

    Mike Warner
    MIGWeb - a Vauxhall Site for Enthusiasts of all Vauxhalls

  • #2
    Ok, ima take a blind shot at this

    <if condition="(in_array(is_member_of($post, array(x,y,z)))) AND ($post[field5])"><div>Drvies: <a href="$post[field6]">$post[field5]</a></div><else /><if condition="$post[field5]"><div> Drives: $post[field5] </div> </if></if>

    You will need to change X Y Z to admin moderator and whatever other group ids that you want to show the link for.

    Comment


    • #3
      Holy cow - I'll give it a try. Thanks for your help, I'll let you know how it goes.
      Mike Warner
      MIGWeb - a Vauxhall Site for Enthusiasts of all Vauxhalls

      Comment


      • #4
        I added the following:

        <if condition="(in_array(is_member_of($post, array(5,6,10,12)))) AND ($post[field5])"><div>Drives: <a href="$post[field13]">$post[field5]</a></div><else /><if condition="$post[field5]"><div> Drives: $post[field5] </div> </if></if>

        .....and got the following error.

        Warning: Wrong parameter count for in_array() in /home/virtual/site1/fst/var/www/html/forums/includes/functions_showthread.php(698) : eval()'d code on line 51

        Any ideas how to fix this?
        Mike Warner
        MIGWeb - a Vauxhall Site for Enthusiasts of all Vauxhalls

        Comment


        • #5
          Anyone?
          Mike Warner
          MIGWeb - a Vauxhall Site for Enthusiasts of all Vauxhalls

          Comment


          • #6
            <if condition="$post[field5]">
            <if condition="$post['field5']">

            You probably also want to check for field6 to be filled in.


            if field5 .. show code:
            if field 6 .. show link
            a href = field6 > field5 </a
            else just show field 5
            field 5
            end field 6
            end if field 5

            and like zachery suggested, throw the usergroup permissions around the main conditional.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X