haxxxton
Forum Replies Created
-
Forum: Plugins
In reply to: [WP REST API Cache] allow Editor to clear cacheI am looking for exactly this same functionality!
Forum: Plugins
In reply to: [Manual Related Posts] in_content post_typesJust FYI, as this hasnt been patched yet, the issue with the first notice can be fixed by changing like 25 to use the key
in_content_mode
instead ofin_content
. Looks like a typo on their behalfForum: Plugins
In reply to: [The Events Calendar] JS error p.tribe_has_attr is not a functionFOLLOW UP: Reinstalling Events Calendar plugins made no change
Forum: Plugins
In reply to: [Force Login] Feature : Allow whitelisting to ignore url query paramsah wonderful, i hadnt thought about the ability to use the
$_SERVER
variable in the whitelist code. Thank you!Forum: Fixing WordPress
In reply to: Custom htaccess, rewrite being overwritten by redirectI found rather then doing the rewriting in .htaccess you should add new custom rewrite rule wordpress way. I added the following to my functions.php file
function my_custom_rewrites(){ add_rewrite_rule( 'img/([^/]+)/comment/([^/]+)', 'index.php?page_id=130&image=$matches[1]&comms=$matches[2]', 'top' ); add_rewrite_rule( 'img/([^/]+)', 'index.php?page_id=130&image=$matches[1]', 'top' ); } add_action( 'init', 'my_custom_rewrites' ); function my_custom_rewrite_tags(){ add_rewrite_tag('%image%','([^&]+)'); add_rewrite_tag('%comms%','([^&]+)'); } add_action( 'init', 'my_custom_rewrite_tags' );
Then in my template file i can reference the tags with the following:
$image = false; if($wp_query->query_vars['image']){ $image = $wp_query->query_vars['image']; } $comms = false; if($wp_query->query_vars['comms']){ $comms = $wp_query->query_vars['comms']; }
i also tried the tips shared here https://docs.dev4press.com/tutorial/practical/debug-wordpress-rewrite-rules-matching/ that might helped understand which Rewrite rule is matching the url and why a particular template is being rendered.
It’s worth mentioning that any time you change your rewrite rules you need to flush them using something like
flush_rewrite_rules(true)
or by going into options->permalinks and just hitting ‘save’Forum: Fixing WordPress
In reply to: hook into completed image upload filterSOLUTION thanks to s_ha_dum (over at wordpressexchange)
function insert_luminance_data($post_ID) { $src = wp_get_attachment_image_src( $post_ID, 'large' )[0]; $lum = get_avg_luminance($src, 10, true); add_post_meta( $post_ID, 'image_lum', $lum, true ) || update_post_meta( $post_ID, 'image_lum', $lum ); return $post_ID; } add_filter('add_attachment', 'insert_luminance_data', 10, 2);
the
get_avg_luminance
function (due to its size) can be found at this pastebin: https://pastebin.com/T97Mj5m8Forum: Fixing WordPress
In reply to: hook into completed image upload filterupdate:
ive now had a look at
- image_attachment_fields_to_save
- attachment_fields_to_save
- wp_handle_upload
- media_upload_form_handler
- wp_generate_attachment_metadata
and i just cant seem to make any of them simply run an addition to the postmeta table for the image
currently my code looks something like:
function insert_luminance_data($post, $attachment) { if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { $lum = 'TEST'; add_post_meta( $post['ID'], 'image_lum', $lum, true ) || update_post_meta( $post['ID'], 'image_lum', $lum ); } return $post; } add_filter('image_attachment_fields_to_save', 'insert_luminance_data', 10, 2);
but like i say.. this isnt working
Forum: Fixing WordPress
In reply to: First / previous / next / latest in category links?can you confirm that the area that allows you to ‘enter a chunk of code’ will allow you to input php.
To test this you could try adding
<?php echo 'test'; ?>
if this displays the word ‘test’ only then there may be some code we can look at. however, i would be surprised if a theme will allow you to enter raw php code.
Forum: Fixing WordPress
In reply to: How the passwords encrypted in wordpressHey Rajesh,
The idea of encryption on the passwords is that it’s generally one directional..
you may be interested in this post from 2 years ago that the lovely esmi helped with https://www.ads-software.com/support/topic/encryption-algorithm-used-for-passwords-in-wp_users-db-table?replies=4
in it she links to this article https://www.cedricve.me/2011/07/18/how-to-make-use-of-wordpress-passwords/
I have also found this particularly useful for understanding the basics of password encryption, hashing and salting https://thomashunter.name/blog/password-encryption-hashing-salting-explained/
with regards to decryption though.. that would be an answer for someone else.. i would imagine even with the salt from the wp_config file, you’d still need to run the encrypted password through some kind of dictionary cracker.. ive not had much experience with that side of the password stuff
Forum: Fixing WordPress
In reply to: Get URI after certain charactersForum: Installing WordPress
In reply to: one login, two installs, one database, one domainargh.. ok so i think i have solved it..
i needed to do 2 extra things..
in the non-main site.. ie the one at https://mysite.com/blog i needed to add the following to the wp-config.php file
define('CUSTOM_USER_TABLE', 'pm_users'); define('CUSTOM_USER_META_TABLE', 'pm_usermeta');
obviously replace pm_ with the prefix of the database for the main section
i had to update the _init_caps function in the capabilities.php file in wp-includes of the non-main site
.. now before the code below i would STRONGLY advise AGAINST changing core files..
function _init_caps( $cap_key = '' ) { global $wpdb; /* if ( empty($cap_key) ) $this->cap_key = $wpdb->prefix . 'capabilities'; else $this->cap_key = $cap_key; */ /*original */ $this->cap_key = 'pm_capabilities'; /*modified code */ $this->caps = get_user_meta( $this->ID, $this->cap_key, true ); if ( ! is_array( $this->caps ) ) $this->caps = array(); $this->get_role_caps(); }
Forum: Fixing WordPress
In reply to: Strip the domain name from the_permalink (multisite posts loop)can you confirm that it is definitely adding the whole domain to the link rather than just ‘/mycategory/mypost’ and that the rest is being added by the browser?
you may have to have a look using firebug or the view source to see what the PHP is actually rendering out..
either way i may be able to help but they are different methods for each so id rather ask first than try to write out both.. (tl;dr: im lazy ?? )
Forum: Fixing WordPress
In reply to: After a content slider compatable with iepersonally i can recommend nivoSlider (website), (plugin)
the only thing i think it might NOT do is allow you to have a title AND a subtitle.. instead this allows for a ‘caption’ but you could do some javascripty goodness to add linebreaks/html markup to make this display how you want i should imagine
now if you are going to MANUALLY add the slider to your files and then just create your sliders in your template files you will need to know that for compatability with IE8 and below you CANNOT place the nivoslider settings javascript on your page (eg as part of your $(window).ready() function).. you have to manually edit the core JS file to have your settings.. i have encountered this issue personally.. (would link you to the support article but it has since been removed)
Forum: Fixing WordPress
In reply to: Comment URL In New Window@Fokkio
you need to have a look at the change i made to the code above..
you need to change where you have
delegate('a','click',function(){
todelegate('a','click',function(e){
this should stop it opening in the current window
Forum: Fixing WordPress
In reply to: Comment URL In New Window@Fokkio
sorry that’s my fault i forgot to add ONE thing to the above code..
thee
infunction(e)
for peoples profile links as well change
.comment-container p
to.comment-container p, .comment-author