• I’m using buddypress which is not as smart as WP at handling URL–
    Users on my site can post items, the name of items are used as part of the URL.
    So, it’d be a problem if somebody want to post an item with a name of “edit” or “my-events”, … those are already part of the URL on my site.

    Luckily, all those posible bad names are in the array of get_post_type_object();

    The problem is, get_post_type_object has some elements are arrays itself.

    I need help to pick an array of “bad_names” from the get_post_type_object array. Then, I can use the “bad_name” array to validate user’s input.

    Thanks for helping!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    So, it’d be a problem if somebody want to post an item with a name of “edit” or “my-events”, … those are already part of the URL on my site.

    How do you figure?

    The BuddyPress URLs would show up as domain.com/groups/groupname/my-event

    or domain.com/activity/p/7912/

    Thread Starter imjscn

    (@imjscn)

    Sorry for blaiming BP. I just checked my plugin code, it’s the plugin’s problem. see the structure:

    $url = apply_filters( 'the_url', $bp->root_domain . '/' . $bp->current_component . '/' . $item->name );

    $item is the object that users posted.

    This special URL is not in the BP URL structure. It opens a lightbox to play vedio.

    In cases when the lightbox javascript failed, the url opens a “Page Not Found”, that means when js failed, this will become a real URL.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Which plugin is this? 😀

    Thread Starter imjscn

    (@imjscn)

    It’s my home made plugin 🙂
    It uses lightbox to make a play vedio. I don’t know js at all, just followed some examples to make it working. So, I need to make sure the url is clean.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pick elements in get_post_type_object’ is closed to new replies.