Mad Dog

Forum Replies Created

Viewing 15 posts - 91 through 105 (of 130 total)
  • Author
    Posts
  • Mad Dog
    Participant

    Ahem…”…not making those fields REQUIRED definitely makes things work right…”

    Sorry about the omission.

    Mad Dog
    Participant

    You’re right, not making those fields definitely makes things work right. We were just trying to make it so if you enter a New Venue from the Add an Event page you HAVE to enter Venue Name and City, otherwise an admin will have to follow up.

    The problem is, simply put: If I use the above code to make Venue Name and Venue City required, when I use a Saved Venue the page throws a validation error saying those fields are required.

    MD

    Mad Dog
    Participant

    No thoughts on this one? Are you able to replicate the problem?

    Mad Dog
    Participant

    No problem George. Sorry if it was confusing. Maybe this will clear it up:

    Below is the code I’m adding in its entirety. Obviously only the second part is relevant to this but I’m including it all in case you need it. It’s taken directly from a TEC snippet:

    // EVENTS Required fields for forms
    add_filter( 'tribe_events_community_required_fields', 'my_community_required_fields', 10, 1 );
     
    function my_community_required_fields( $fields ) {
        $fields = array(
            'post_title',
            'post_content',
            'EventCost',
            'EventCurrencySymbol',
            '_ecp_custom_2',
            '_ecp_custom_7',
    		'_ecp_custom_8',
    
        );
     
        // Requiring the organizer email (or other "square bracketed" fields) can't be done using the above approach,
       //but we can simply test within the $_POST superglobal directly. If a field hasn't been populated then we simply 
       //add a requirement using a field name we know doesn't exist, but can be used to form a meaningful error message 
       //(if the org email is missing the user will see "Organizer Email is required").
        if ( empty( $_POST['venue']['Venue'] ) )
            $fields[] = 'Venue Name';
        if ( empty( $_POST['venue']['City'] ) )
            $fields[] = 'Venue City';
        if ( empty( $_POST['organizer']['Organizer'] ) )
            $fields[] = 'Organizer Name';
        if ( empty( $_POST['organizer']['Email'] ) )
            $fields[] = 'Organizer Email';
     
        return $fields;
    }
    

    When I use this code I get the “Venue required” errors when using a SAVED VENUE. Using a SAVED ORGANIZER doesn’t throw an error message.

    – If I comment out the Venue lines like below I can Add an Event with a SAVED VENUE without throwing a validation error. (Organizer is never a problem…that’s what I think I confused you with. This is only a problem with Saved Venue when I make those two Venue fields required.)

    //if ( empty( $_POST['venue']['Venue'] ) )
        //    $fields[] = 'Venue Name';
    	//if ( empty( $_POST['venue']['City'] ) )
        //    $fields[] = 'Venue City';
    	if ( empty( $_POST['organizer']['Organizer'] ) )
            $fields[] = 'Organizer Name';
    	if ( empty( $_POST['organizer']['Email'] ) )
            $fields[] = 'Organizer Email';
    

    Is there something wrong with my code for the Venue name and city??

    • This reply was modified 8 years, 8 months ago by Mad Dog. Reason: clarity
    • This reply was modified 8 years, 8 months ago by Mad Dog.
    in reply to: Community Events page has disappeared #1004628
    Mad Dog
    Participant

    This reply is private.

    in reply to: Changing the names Venue and Organizer on the front end? #1004614
    Mad Dog
    Participant

    My bad. I didn’t notice that you’re going about this a different way than I am (mine is also from the TEC snippets list). I’d try one thing and if that doesn’t work wait for a TEC Support person to get back.

    Try changing this:

    if(strpos($domain, ‘tribe-‘) === 0 && array_key_exists($text, $custom_text) ) {

    To this: if(strpos($domain, ‘the-‘) === 0 && array_key_exists($text, $custom_text) ) {

    All you’re changing is “tribe” to “the.”

    in reply to: Changing the names Venue and Organizer on the front end? #1004608
    Mad Dog
    Participant

    After reading it a few times and looking at the articles, it became obvious….just not stated as well as it could have. Replace “tribe” with “the”:

    Change this line: if ($domain == 'tribe-events-calendar') {

    To this: if ($domain == 'the-events-calendar') {

    And the language translation function works fine.

    in reply to: Changing the names Venue and Organizer on the front end? #1004590
    Mad Dog
    Participant

    Me too. I was about to post because I noticed that when I used TEC-supplied code to change “venue” to “location” (see below) it stopped working. No problem making some changes but the blog post you referenced doesn’t tell me much about what needs changing to make this code work again:

    // Change VENUE to LOCATION
    function filter_translations($translation, $text, $domain) {
        if ($domain == 'tribe-events-calendar') {
            switch ($text) {
                case 'Venue':
                    $translation = 'Location';
                    break;
            }
        }
     
        return $translation;
    }
    add_filter('gettext', 'filter_translations', 10, 3);

    Apparently ($domain == 'tribe-events-calendar') needs to be changed but it’s unclear to what.

    • This reply was modified 8 years, 8 months ago by Mad Dog. Reason: update
    Mad Dog
    Participant

    George–

    I know it sounds confusing at this point but it’s actually not:

    – If I DON’T have this code included in the function, everything works perfectly and as it should.

    – When I do add this code, I get the “Venue Name is required. Venue City is required.” error when adding a new Events using a Saved Venue.

    – However…with this code added I DON’T have a similar problem with the Organizer fields when using a Saved Organizer. It works fine.

    So the problem is only for Venue when using this code and a Saved Venue (I can add a new venue with the new event fine).

    Hope that’s clear….

    Mad Dog
    Participant

    The problem is simple but I’m not sure why it’s not working. To be honest, it might not have worked right before the recent plugin update — I’m not sure if I tested it.

    Anyway, I wanted to make Venue Name and Venue City required fields. Following TEC instructions, I added the code below as part of the function. Oddly, it doesn’t have a problem with the Organizer required fields using a Saved Organizer, but does throw an error for the required Venue fields when using a Saved Venue!

    If I comment out the Venue requirement lines all is good.

    Is there something wrong with my code?

        // Requiring the organizer email (or other "square bracketed" fields) can't be done using the above approach, but we can
        // simply test within the $_POST superglobal directly. If a field hasn't been populated then we simply add a requirement
        // using a field name we know doesn't exist, but can be used to form a meaningful error message (if the org email is
    	// missing the user will see "Organizer Email is required").
        if ( empty( $_POST['venue']['Venue'] ) )
            $fields[] = 'Venue Name';
    	if ( empty( $_POST['venue']['City'] ) )
            $fields[] = 'Venue City';
    	if ( empty( $_POST['organizer']['Organizer'] ) )
            $fields[] = 'Organizer Name';
    	if ( empty( $_POST['organizer']['Email'] ) )
            $fields[] = 'Organizer Email';
     
        return $fields;
    in reply to: Hide Recurring Events on Add Event page CONDITIONALLY? #1004316
    Mad Dog
    Participant

    [IMG]http://i61.tinypic.com/szzzir.png[/IMG]

    in reply to: Hide Recurring Events on Add Event page CONDITIONALLY? #1004305
    Mad Dog
    Participant

    Before the recent update, wasn’t there a “Recurring Event?” checkbox on the Add an Event page so it didn’t show that section unless you checked it? That’s what I remember….and it seems to be gone and always showing recurring event info which is what I’m trying to get around.

    Or do I not remember how it was?

    MD

    P.S. This is what I see now by default…and don’t know what the arrow triangle on the right is. It does nothing though it does change up/down.

    • This reply was modified 8 years, 8 months ago by Mad Dog.
    • This reply was modified 8 years, 8 months ago by Mad Dog.
    • This reply was modified 8 years, 8 months ago by Mad Dog.
    Mad Dog
    Participant

    This reply is private.

    in reply to: Hide Recurring Events on Add Event page CONDITIONALLY? #1004005
    Mad Dog
    Participant

    This plot thickens…..

    I see there is (was!) a checkbox for Recurring Events that did exactly what I’m looking for. No wonder it felt so familiar. But it’s not functional now. It’s an unclickable square floating to the right (.tribe-event-recurrence .tribe-handle) with no actual input!

    What I get is:

    Recurrence Rules: [ONCE] A triangle that switches up and down with no label of function
    [Add Another Rule]

    in reply to: Hide Recurring Events on Add Event page CONDITIONALLY? #1003983
    Mad Dog
    Participant

    Forget it. Unless you have a more built-in way, a little research and I figured it out using something like this test version:

    <script>
    $(document).ready(function(){
        $(".test").hide();
        $("#recurring-test").click(function(){
            $(".test").toggle(600);
        });
    });
    </script>
    
    <body>
    
    <label>Recurring Event? </label><input type="checkbox" id="recurring-test">
    <br /><br />
    
    <table>
    <tr class="test"><td>This is Recurring Event info.</td></tr>
    <tr><td>This is another small paragraph.</td></tr>
    </table>
    
    </body>
    
    
    • This reply was modified 8 years, 8 months ago by Mad Dog. Reason: Display code better
    • This reply was modified 8 years, 8 months ago by Mad Dog.
Viewing 15 posts - 91 through 105 (of 130 total)