This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function whatismyip() { | |
if (isset($_SERVER['HTTP_CLIENT_IP'])) | |
$ipaddress = $_SERVER['HTTP_CLIENT_IP']; | |
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
else if(isset($_SERVER['HTTP_X_FORWARDED'])) | |
$ipaddress = $_SERVER['HTTP_X_FORWARDED']; | |
else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp', function() { | |
if( '1' == get_query_var('se_random_post') ) { | |
$count = count( get_posts() ); | |
if( (int) $count <= 0 ) | |
return; // no posts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('init', function() { | |
// rewriting site.ext/index.php?se_random_post=1 to site.ext/random/ | |
add_rewrite_rule( | |
'random/?$', | |
'index.php?se_random_post=1', | |
'top' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp', function() { | |
if( get_query_var('se_random_post') ) { | |
$post = get_posts(array('posts_per_page' => 1, 'orderby' => 'rand')); | |
$post = array_shift($post); | |
if( $post && $post->ID ) { | |
wp_safe_redirect( get_permalink( $post->ID ) ); | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Users Table Last Seen | |
Plugin URI: http://samelh.com | |
Description: updates users last seen status each time they browse the front-end and adds last seen to users table with user last seen time difference | |
Author: Samuel Elh | |
Version: 0.1 | |
Author URI: http://samelh.com | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function se_bbpm_add_spam_check() { | |
/** | |
* add spam check for users with bbp_spectator and bbp_participant roles | |
* Add more roles in the $targetRoles line or replace existing ones to match | |
* your targeted users | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('bbpm_conversation_form_additional_fields', function() { | |
/** | |
* Follows is just an example on how to implement a simple captcha, | |
* You can set the answer in a cookie or database option and fetch | |
* it with a unique key, or store it somewhere else, use honeypot and | |
* spam hidden traps, reCaptcha, or simply a captcha image.. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function se_bbpm_add_spam_check() { | |
/** | |
* add spam check for users with bbp_spectator and bbp_participant roles | |
* Add more roles in the $targetRoles line or replace existing ones to match | |
* your targeted users | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_init', function() { | |
// Specify here the plugin name and that's all | |
$requested_name = 'AJAX File Upload'; | |
function se_plugin_has_update( $name ) { | |
if ( ! function_exists( 'get_plugin_updates' ) ) { | |
require_once ABSPATH . 'wp-admin/includes/update.php'; |
OlderNewer