Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] - Only show page on menu if logged in
#6
(2016-01-18, 15:51:17)jwzumwalt Wrote:
(2016-01-18, 07:04:36)DimaYakovlev Wrote: get_navigation_customget_navigation

Wow!   Thanks,  you are really talented...

Now if you feel like helping on something else, I would like to have a button show up on a "404 page not found" that allows the missing page to be created (if the user has backend privileges).

Somehow, the missing page link needs to be sent to the "404 page not found" for a button to be created.

Thanks ahead of time, if you try to solve this Smile

Well... This is quick and dirty solution for your need. Smile
PHP Code:
<?php
/*
Plugin Name: New Page From 404
Description: Helps user to create a new page from 404 
Version: 0.1
Author: Dmitry Yakovlev
Author URI: http://dimayakovlev.ru
*/

$thisfile basename(__FILE__'.php');

# register plugin
register_plugin(
 
 $thisfile,
 
 'New Page From 404',
 
 '0.1',
 
 'Dmitry Yakovlev',
 
 'http://dimayakovlev.ru',
 
 'Helps user to create a new page from 404',
 
 '',
 
 ''
);

add_action('admin-pre-header', function() {
 
 global $url;
 
 if (basename($_SERVER['PHP_SELF']) == 'edit.php') {
 
   if (!$url && isset($_GET['newpagefrom404'])) {
 
     $url $_GET['newpagefrom404'];
 
   }
 
 }
});

function 
get_new_page_from_404_link($link_title) {
 
 global $id;
  global $GSADMIN;
  if (is_logged_in() && $id != '404') {
 
   $url get_site_url(false) . $GSADMIN '/edit.php?newpagefrom404=' urlencode($id);
 
   echo '<a href="' $url '">' $link_title '</a>';
 
  


1. Create plugin with this code and activate it.
2. Create 404 page and template for it.
3. Place in 404 page template this code (in place where you want to get the link to new page creation page):
PHP Code:
<?php if (function_exists('get_new_page_from_404_link')) get_new_page_from_404_link('Create a new page'); ?>
Reply


Messages In This Thread
RE: Only show page if logged in - by Frens - 2016-01-13, 04:40:45
RE: Only show page if logged in - by shawn_a - 2016-01-13, 04:42:43
RE: [SOLVED] - Only show page on menu if logged in - by DimaYakovlev - 2016-01-18, 17:54:12



Users browsing this thread: 1 Guest(s)