tombenner
Forum Replies Created
-
Hi Emily,
I’ve actually been meaning to add a setting in this plugin that lets you set what page the user should be sent to after logging, but haven’t had the time yet. I’m not sure how soon I’ll be able to add it, but I can let you know when I do.
In the meantime, though, you might try using a plugin dedicated to this, such as Peter’s Login Redirect, which would hopefully work in concert with this plugin, but I haven’t tested it.
The code for a logout link would be:
<a href="<?php echo wp_logout_url(); ?>" title="Sign out">Sign out</a>
Or, you can use one of the functions that Front-End Users provides to display a set of links like “Sign in | Register”, “John | Sign out”, or “John | Dashboard | Sign out”, depending on whether the user is logged in and has access to the admin section:
<?php echo feu_user_header_links(); ?>
To add one of these to only the user settings page, you would add the above code to front-end-users/views/settings.php, perhaps above the line with
<?php feu_box_(); ?>
.To add one of these to the header of every page on the site, you would add the code to the file named header.php in your theme.
And, of course, If any of this seems unclear, or if you need any more detail, please let me know.
Best,
TomApologies–I’ve been meaning to write some more in-depth documentation on this, but haven’t had the time yet.
After activating the plugin, there should be an edit profile page at “https://mysite.com/profile”. (In case it’s not clear, this page isn’t a Page with a capital P, but rather a PHP file at
front-end-users/views/settings.php
, so that it’s easier to customize its code.)To make it easier to modify the login and registration pages so that they look more like the rest of the front-end site, Front-End Users provides three helpful functions that you’ll want to define in your theme’s functions.php:
feu_login_head_element()
,feu_login_header()
, andfeu_login_footer()
. The functions will output content in, respectively, the login and registration pages’<head>
element, closely after their opening<body>
tag, and closely before the closing</body>
tag. This would allow you to add, for example, CSS into the<head>
element to style to login and registration pages, a nav menu after the<body>
, and a footer nav menu before the closing</body>
.One way to do this is to logically group the contents of your theme’s header.php and footer.php into different files (e.g. move the
<meta>
tags from header.php intoincludes/header-meta.php
, move the content after the opening<body>
tag intoincludes/header-content.php
, etc). You can then include each of the theseincludes/
files in both the appropriate Front-End Users function and in either header.php or footer.php. Here’s an example of what the three functions might look like:global $theme_path; $theme_path = get_theme_root().'/'.get_template().'/'; function feu_login_head_element() { global $theme_path; require $theme_path.'includes/header-title.php'; require $theme_path.'includes/header-meta.php'; require $theme_path.'includes/header-css.php'; require $theme_path.'includes/header-js.php'; wp_head(); } function feu_login_header() { global $theme_path; require $theme_path.'includes/header-content.php'; } function feu_login_footer() { global $theme_path; require $theme_path.'includes/footer-content.php'; wp_footer(); require $theme_path.'includes/footer-js.php'; }
This example is taken from front-end-users/example_hooks.php, which also shows some other useful hooks that Front-End Users provides.
Please let me know if any of this is unclear. This all unfortunately requires a little familiarity with PHP, but there really didn’t seem to be a simpler way to do it.
Best,
TomForum: Plugins
In reply to: [Front-End Users] [Plugin: Front-End Users] /profile/ 404 Not FoundHm, I’m not terribly familiar with nginx, unfortunately. Could the fact that “Apache” is mentioned in the 404 page be an indication that nginx isn’t serving up that page?
Otherwise, if you haven’t already, it might be good to see whether pretty URLs are working for blog posts or not, as that might indicate a larger issue.
It might also be worthwhile to try other rewriting approaches. This looks like it might be promising. (Be sure to restart nginx after making a change, of course.)
Let me know if any of this helps; I’d be interested to see what the issue is here.
Best,
TomWhich admin page would you like to show? There unfortunately isn’t a simple switch that would allow you to show an existing admin page on the front-end, as the admin pages usually require all of the admin functionality to be loaded, and loading all of that is generally a bad idea for many reasons (page load speed, possible conflicts, etc).
To add a page to the front-end using Front-End Users, you’ll probably need to be a little familiar with PHP. As an example, to add a page named “My Page” that has the URL https://mysite.com/profile/my-page, you would put the following in your theme’s functions.php:
add_filter('feu_settings', 'change_feu_settings'); function change_feu_settings($settings) { $settings['views'] = array( 'index' => array( 'title' => 'Settings', 'file' => 'settings' ), 'my-page' => array( 'title' => 'My Page' ) ); return $settings; }
To create the content of the “My Page”, you would make a file in plugins/front-end-users/views/ named “my-page.php” that contains PHP code like this:
<?php feu_header(); ?> <?php feu_box_(); ?> <h1>My Page</h1> <p>Some content here...</p> <?php _feu_box(); ?> <?php feu_footer(); ?>
For details on how to configure these pages (which Front-End Users refers to as “views”), please see the comments near the “change_feu_settings” function in front-end-users/example_hooks.php.
Front-End Users also provides a number of functions that can be useful in these views. They are listed and described in front-end-users/functions.php.
Hope this helps; definitely let me know if anything seems unclear or if you have any other questions.
Best,
Tom