Page 1 of 5 123 ... LastLast
Results 1 to 10 of 49

Thread: Prevent Posting In Main Category Easy Fix

  1. #1
    Thread Starter
    isdngirl's Avatar
    Join Date
    Apr 2010
    Posts
    29
    Thanks
    0
    Thanked 6 Times in 2 Posts

    Prevent Posting In Main Category Easy Fix (javascript)

    Hi this is the easiest way I have come up with to prevent users from selecting and posting in main categories.

    Step 1: Open includes/form/step1.php

    Step2: Locate the following code:
    Code:
     <?php
                            if (get_option('cp_price_scheme') == 'category' && get_option('cp_enable_paypal') == 'yes') {
                                cp_dropdown_categories_prices('show_option_none='.__('Select one','cp').'&class=dropdownlist&orderby=name&order=ASC&hide_empty=0&hierarchical=1&exclude_tree='.CP_BLOG_CAT_ID);
                            } else {
                               wp_dropdown_categories('show_option_none='.__('Select one','cp').'&class=dropdownlist&orderby=name&order=ASC&hide_empty=0&hierarchical=1&exclude_tree='.CP_BLOG_CAT_ID);
                            }
                            ?>
    Step 3: Paste in this tiny javascript directly underneath and outside of the php above
    Code:
    <script type="text/javascript">
    var dropdown = document.getElementById("cat");
    function removeOptions(dropdown)
    {
    var i;
    for(i=dropdown.options.length-1;i>=0;i--)
    {
    if(dropdown.options[i].className === 'level-0')
    dropdown[i].disabled="disabled";
    }
    }
    </script>
    Step 4: Save php document and you should be all set

    If you wanted to get real fancy and correct you could do a replace on the className of level-0 on the selct with an optgroup then append the close optgroup at the end of the array, but this is the quickest.

    Hope this helps someone (only tested in ie8 and ff 3 - let me know if its broken somewhere else)
    Last edited by pepsi; August 8th, 2010 at 03:43 AM.

  2. The Following 4 Users Say Thank You to isdngirl For This Useful Post:

    clarkbullen (September 29th, 2010), screenrage (August 9th, 2010), steeld (October 30th, 2010), yoodac (August 12th, 2010)

  3. #2
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #3
    Thread Starter
    isdngirl's Avatar
    Join Date
    Apr 2010
    Posts
    29
    Thanks
    0
    Thanked 6 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Thread Starter
    isdngirl's Avatar
    Join Date
    Apr 2010
    Posts
    29
    Thanks
    0
    Thanked 6 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #5
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,978
    Thanks
    170
    Thanked 3,407 Times in 3,278 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  7. #6
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #7
    Member barry's Avatar
    Join Date
    Jul 2010
    Location
    South Africa
    Posts
    99
    Thanks
    40
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #8
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,978
    Thanks
    170
    Thanked 3,407 Times in 3,278 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  10. The Following User Says Thank You to jomarkosabel For This Useful Post:

    barry (August 9th, 2010)

  11. #9
    Member screenrage's Avatar
    Join Date
    Jul 2010
    Location
    The Moon, Alice!
    Posts
    61
    Thanks
    4
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #10
    jschodde's Avatar
    Join Date
    Apr 2009
    Location
    Anthem, AZ
    Posts
    154
    Thanks
    3
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 5 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Category selection when posting new ad
    By greencode in forum ClassiPress General Discussion
    Replies: 5
    Last Post: August 16th, 2010, 04:41 AM
  2. How to change category to COMPANY NAME on post Main Page
    By mfreund in forum ClassiPress General Discussion
    Replies: 2
    Last Post: June 5th, 2010, 06:48 PM
  3. Add Icon on Ad Categories per Main Category
    By icecubejackal in forum Help Using ClassiPress
    Replies: 1
    Last Post: June 3rd, 2010, 04:46 PM
  4. Category selection when posting new ad
    By greencode in forum Help Using ClassiPress
    Replies: 0
    Last Post: December 31st, 1969, 07:00 PM