The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




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: 2 Guest(s)