Home › Forums › Calendar Products › Community Events › Basic community events user registration question
- This topic has 12 replies, 2 voices, and was last updated 10 years, 2 months ago by
George.
-
AuthorPosts
-
February 16, 2016 at 5:00 pm #1074081
clarity
ParticipantWe have purchased and installed Community Events. As a logged in user, the form works well. But if you are not logged in, going to the /community/add page creates a custom page at the same URL with it’s own login form and a link to the standard WordPress registration page. Example:
http://avindustrycalendar.com/events/community/add/
We have our own custom login form and registration page. We don’t want the Add an Event page to create its own login form. We want it to go to our form where users can register or log in:
http://avindustrycalendar.com/login-register/
I can’t imagine this is not a common question. The standard login form used looks terrible and is not customizable. How can we change that?
February 16, 2016 at 11:31 pm #1074168George
ParticipantHey @clarity,
The login from in Community Events is not something generated by Community Events – we use the function built into WordPress itself, wp_login_form().
You can change the output and build a whole new form on your site, but a simple solution might be to just add this code to your theme’s functions.php file – it will redirect logged-out users on the Community Events submission page to the form you want them to see. Users who are logged-in will not be affected and can access the submission form without issue though:
add_action( 'tribe_ce_event_submission_login_form', 'redirect_to_better_login_page' );
function redirect_to_better_login_page() {
if ( ! is_user_logged_in() ) {
wp_safe_redirect( 'http://avindustrycalendar.com/login-register/' );
die();
}
}
February 17, 2016 at 8:30 am #1074534clarity
ParticipantI am confused… this did not do anything. I added this code to the beginning of my functions.php file.
February 17, 2016 at 11:24 am #1074605clarity
ParticipantActually, to clarify:
add_action( ‘tribe_ce_event_submission_login_form’, ‘redirect_to_better_login_page’ );
This calls a function that doesn’t exist – error
February 18, 2016 at 7:44 am #1075104George
ParticipantHey @Clarity,
That is bizarre! The function is literally defined right there, so that error should not be displaying and this works very well for me.
Can you copy and paste your ENTIRE, UN-EDITED functions.php file into a Gist at http://gist.github.com and then share a link to this Gist?
I will take a look and see if I can spot what’s wrong.
Thanks,
GeorgeFebruary 18, 2016 at 8:27 am #1075148clarity
ParticipantHere is the link. All I did was add a few line feeds and insert your code. Breaks the site immediately:
https://gist.github.com/anonymous/f5555dc2e2e0d11936ba
Here is the browser error:
Fatal error: Call to undefined function add_action() in /home/integrat/public_html/avindustrycalendar/wp-includes/functions.php on line 11
February 19, 2016 at 10:43 am #1078364George
ParticipantHey Clarity,
Thanks for this, I see what the issue is—when I said “your theme’s functions.php file”, I perhaps wasn’t being as clear as I could’ve been!
I am referring to a file within your theme’s folder that is called functions.php. You might be familiar with this file, but if not, then let’s say for example your theme is Twenty Sixteen (I know it’s not, but just for example). Then the file I am referring to would be at this location:
/wp-content/themes/twenty-sixteen/functions.php
The “functions.php” file you’ve added the code to presently is in another location in your WordPress installation.
Remove the code from that functions.php file and try adding it to the file in your theme’s functions.php file.
Learn more about theme functions files here, if you’re curious → https://codex.wordpress.org/Functions_File_Explained
Thanks,
GeorgeFebruary 19, 2016 at 11:10 am #1078393clarity
ParticipantOK, my bad. I have added it to the functions.php in my theme (its a child theme). Here is the complete contents of that file:
<?php add_action( 'tribe_ce_event_submission_login_form', 'redirect_to_better_login_page' ); function redirect_to_better_login_page() { if ( ! is_user_logged_in() ) { wp_safe_redirect( 'http://avindustrycalendar.com/login-register/' ); die(); } } ?>It does not work. a non-logged in user is still directed to the same custom page. Ideas?
-
This reply was modified 10 years, 2 months ago by
clarity.
February 22, 2016 at 11:48 am #1080099George
ParticipantUnfortunately there still seems to be an issue with the implementation of that custom code.
I have tested this numerous times, even now within a child theme, and it works fine, so I’m wondering — it seems like you might be using apostrophes in your custom snippet, which is something that you likely did not do intentionally, but it happened as a result of your copying-and-pasting.
I would recommend the following exact steps:
1. Remove all previously-attempted pastes of the code snippet from your theme’s functions.php files.
2. In your wp-admin, go to Appearance > Editor and navigate to the child theme functions.php file.
3. Make sure this file is completely empty, and then replace the contents with the content of the complete text at this link: https://git.io/v2YRF
4. Do not add anything or remove anything. Do not add a closing ?> tag, nothing at all. Just copy the above-shared code in the link in step #3 100% exactly as-is. Change nothing.
5. Save the changes.
6. See if things work.
7. If not, go back to the editor and to the child theme functions.php file.
8. Change wp_safe_redirect to wp_redirect. Do not change any other characters in the file—all you’re doing here is literally taking “safe_” out of the “wp_safe_redirect” text.
9. Save the changes. See if things work.
If things still fail after all of this, then repeat the steps but place the code in your parent theme’s functions.php file and see if that helps.
Thank you,
GeorgeFebruary 22, 2016 at 5:20 pm #1080338clarity
ParticipantOK, I have done this again. It STILL redirects to:
http://avindustrycalendar.com/events/community/add/
I want it to redirect to:
http://avindustrycalendar.com/login-register/
I have done everything as specified in the response. It is not working. I have removed “safe_”, it is not working. I still get this error:
http://avindustrycalendar.com/events/community/add/
Warning: Cannot modify header information – headers already sent by (output started at /home/integrat/public_html/avindustrycalendar/wp-content/themes/Divi-child/functions.php:1) in /home/integrat/public_html/avindustrycalendar/wp-includes/pluggable.php on line 1228
February 23, 2016 at 9:48 am #1080855George
ParticipantThis reply is private.
February 23, 2016 at 3:40 pm #1081081clarity
ParticipantGeorge…
Well, this is embarrassing – for both you and me.
You gave me these directions a couple messages ago:
3. Make sure this file is completely empty, and then replace the contents with the content of the complete text at this link: https://git.io/v2YRF
I did exactly that. Please look at the code you gave me. You did not close the PHP section. I did as suggested an left the PHP open. I should have seen that. I sent you exactly what was in my functions.php file, and you didn’t catch it either.
I am sorry for missing that. To my defense, I was following directions.
Thank you for all the help. It now works.
February 23, 2016 at 3:58 pm #1081088George
ParticipantHey Clarity, the functions.php file does not require a closing PHP tag, and in fact most of the time it can cause issues to add the unnecessary tag there. I’m glad things are resolved now regardless.
Be sure to bookmark this thread and/or otherwise backup that custom code in case its lost in a theme or site update; that’s unlikely, but just in case!
Best of luck with your project,
George -
This reply was modified 10 years, 2 months ago by
-
AuthorPosts
- The topic ‘Basic community events user registration question’ is closed to new replies.
