Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

WanderlustShutter on "Login with wp_dropdown_pages"

$
0
0

Hello

I need to build website where different clients have access only to their personal pages. My idea is to use wp_dropdown_pages() as login. Basically each client (USER in WP) is named same as personal PAGE. I managed to make things work till the moment when I need to combine dropdown data with login form.
Does anyone know how to send data (page name) from dropdown to wp_login_form() as LOGIN and just type password in the box?
This is my code:

// Add login form to menu
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

function add_login_logout_link($items, $args) {
// start buffering
ob_start();
// this is the actual form function
$login_args = array(
'redirect' => admin_url(),
'form_id' => 'loginform-custom',
'label_username' => __( 'Username custom text' ),
'label_password' => __( 'Password custom text' ),
'label_remember' => __( 'Remember Me custom text' ),
'label_log_in' => __( 'Log In custom text' ),
'remember' => false
);

$dropdown_pages_args = array(
'depth' => 0,
'child_of' => 6,
'selected' => 0,
'echo' => 1,
'name' => 'page_id',
'id' => null, // string
'class' => null, // string
'show_option_none' => null, // string
'show_option_no_change' => null, // string
'option_none_value' => null, // string
);

//Dropdown Pages
wp_dropdown_pages( $dropdown_pages_args );

wp_login_form($login_args);
// get buffering
$loginoutform = ob_get_contents();
// clean buffering
ob_end_clean();
$items .= $loginoutform ; // concatenate buffering with items ...
return $items;
}


Kaxien on "Change in /wp-login.php"

$
0
0

Hi - can you help with this?

On the http://www.x.xx/wp-login.php site the classic login site apears

'Username'
'Password'

Now I am about to make a page for students, and they must be able to log in with their student number. Can we somehow make 'Username' to 'Student Number' instead? I have searched alot, but the only thing I reach are plugins and methods to change the image on the login page.

Do you have a method?

techdruid on "can't get active_installs in WordPress API returned"

$
0
0

I'm coding this completely outside of WordPress. I'm simply trying to return the number of active installs for a given plugin. I've been all over the documentation and forums and have tried what seems to be correct, but it continues to not return the variable. Any advice?

$slug   = "drop-cap-shortcode";

$apiurl = "http://api.wordpress.org/plugins/info/1.0/";

$payload = array(       'action'        => 'plugin_information',
                        'request'       => serialize(array(     'slug'=>$slug,
                                                                        'fields'=>array('active_installs'=>true)
                                                                )
                                           )
                );

echo "SENDING\n";
print_r($payload);

$ch = curl_init($apiurl);
$ch = curl_init($apiurl.$slug);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,array('body'=>$payload));

$return = curl_exec($ch);
curl_close($ch);

$ret = (array) unserialize($return);

echo "rating          : " . $ret[rating] . "\n";
echo "downloads       : " . $ret[downloaded] . "\n";
echo "last updated    : " . $ret[last_updated] . "\n";
echo "active installs : " . $ret[active_installs] . "\n";

The result will not ever come back with active_installs. Any help?

destanylaval on "Adding a 2nd Entry box for emails?"

$
0
0

Checkout - only single entry box for email. Best practice is to have duplicate entry to help ensure no typos. Otherwise customer will not get notifications and that will increase customer service costs.

Is there a way that I can add a 2nd entry box for emails?

Victoria

kikib on "Limiting the custom excerpt to two paragraphs"

$
0
0

I created an custom excerpt based on this tutorial (http://wpden.net/create-multiple-excerpts-wordpress/) but I wanted to edit the excerpt to show only two paragraphs of the post content. After researching, I found two solutions: (http://www.codecheese.com/2013/11/get-the-first-paragraph-as-an-excerpt-for-wordpress/#comment-8293) and http://stackoverflow.com/questions/24805636/wordpress-excerpt-by-second-paragraph. But the problem is that those codes replace the original excerpt which affect other normal excerpts that I uses in other places. I wanted to apply this code to this only custom excerpt.

My original custom excerpt is:

function wpden_excerpt($length_callback = '', $more_callback = '')
{
    global $post;
    if (function_exists($length_callback)) {
        add_filter('excerpt_length', $length_callback);
    }
    if (function_exists($more_callback)) {
        add_filter('excerpt_more', $more_callback);
    }
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    $output = '<p>' . $output . '</p>';
    echo $output;
}
// Custom Length
function wpden_mag_len($length) {
    return 200;
}
function wpden_more_view($more){
global $post;
return '... <a class="view-article" href="' . get_permalink($post->ID) . '">' . __('', 'wpden') . '</a>';
}

and I call it in my template.php:
<?php wpden_excerpt('wpden_mag_len','wpden_more_view'); ?>

I tried to add the code to my original code and tried many variations but I couldn't get it to work!!! Here's one of the variations I tried:

function wpden_excerpt($text, $raw_excerpt)
{
    global $post;
  if( ! $raw_excerpt ) {
        $content = apply_filters( 'the_content', get_the_content() );
        $text = substr( $content, 0, strpos( $content, '</p>' ) + 4 );
    }
    return $text;

	if(function_exists($text)) {
		add_filter( 'wp_trim_excerpt', 'wpden_excerpt');
	}
	echo $text;

}

In which I call it in my template.php:
<?php wpden_excerpt(); ?>

but it didn't work. I need help. Basically, I wanted the excerpt to display two paragraphs without the "read more" link at the end....

Emmy25 on "Many Administrators on account being created after deleted"

$
0
0

We have many different administrators on our account with unknown users. The users keep appearing after we delete them. We have seen spam text advertisements published on pages. When we delete those unknown administrators some of our pages (which they did not publish) were found in the trash. When we restored these pages all the images were gone. Does anyone know what can be done to remedy this hack?
One of the administrators email addresses is useradmin@gmail.com. we also found unknown Russian language in our code. When we google this email address the same language comes up. Definitely spam. Can anyone help?

RMSHAH on "Hacker is Sending Links To My Site Non-existant Pages"

$
0
0

Dear sir,

I've been facing this issue last five months and unable to sort out this issue, so finally, I come here and expecting to be sorted out today.

Here is the example:

https://gyazo.com/76914fdd9bf75ebaa077f171b5a9a7c9

My site is: weedeaterguru.com

Now, if you look at the screenshot and click on the my site link, it landing to 404 page error.

Many expert said, 404 won't harm your ranking, but I am seeing the trust of my site gradually decreased and it is now only TF2

I build few powerful links but site kws doesn't move up, they stick to their previous ranking.

Hacker is sending daily hundreds of links each day.I want him to stop these. Most of the links I seen coming form russian and chinese types sites and forums as well.

What to do? Please, give me some advise.

Thanks

fred_78 on "send mail with order info (woocommerce) when order completed"

$
0
0

I have made this code and tried it as a plugin and in functions.php
The email is sending but I can only retrieve the order number. get_post_meta is not working.
$order->billing_first_name is not working either
Any idea please ???

function order_completed00($order_id) {

		$order = new WC_Order($order_id);
		$nn=$order->get_order_number();

		$msg =  'hello, ' . $order->billing_first_name . '.<br />';
		$msg .= 'order info:' . $order->get_order_number() . ' .<br />';
		$msg .= 'Obrigado.'.get_post_meta( $order_id, '_payment_method', true ).get_post_meta( $nn, '_payment_method', true );

$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( 'email@gmail.com', 'email from plugin', $msg, $headers );

}
add_action( 'woocommerce_new_order', 'order_completed00' );

terjemk on "PHP error Exclude post categories from loop"

$
0
0

Hi, unsure if correct forum but here goes.

I have an installation with Buddy theme installed with buddypress. I want to exclude a category of post from the loop and found this code at http://wpsites.net/web-design/exclude-category-posts-page/

add_action( 'pre_get_posts', 'exclude_category_posts' );
/**
* @author Brad Dalton - WP Sites
* @example http://wpsites.net/web-design/exclude-category-posts-page/
*/
function exclude_category_posts( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'cat', '-27,-30' );
}
}

When I put this in my functions.php in my child theme, the admin outputs this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/buddy-child/functions.php:37) in /home/mysite/public_html/wp-admin/post.php on line 242

Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/buddy-child/functions.php:37) in /home/mysite/public_html/wp-includes/pluggable.php on line 1207

The frontend is not affected, but shows the category ID I want to exclude.

Can anyone please help me find out what the problem is?

Terjemk

trustamericadirect.com on "my site has been hacked by a terrorist group"

$
0
0

Below is what I get when I try to go to my site::::

HACKED BY g0nzalez and Selyani17

TUNISIAN FALLAGA TEAM

Death To zionist

מוות לציוני

الموت لبني صهيون

No peace between us, which binds us , is only war ,we win or we win no. other choice

אין שלום בינינו, שקושר אותנו, הוא המלחמה רק, אנחנו מנצחים או שננצח לא. ברירה אחרת

אויב ישראלי, אתם המטרה היחידה והאויב היחיד, אני גדלתי על זה, ואתה תמיד יהיה האויב שלי ושלום

מעולם לא דחה איתך, הקשר היחיד בינינו לבינך הוא במצב של מלחמה התמידית, יום אחד נפגש בשדה הקרב ..!!

عدوي الإسرائيلي ، أنت هدفي الوحيد و عدوي الوحيد ، تربيت على ذلك ، و ستكون أنت دائماً و أبداً

عدوي ، السلام مرفوض معكم ، العلاقة الوحيدة بيننا و بينكم هي حالة الحرب الدائمة ، يوما ما سوف نلتقي على أرض المعركة

Israeli enemy, you are my only goal is the only enemy, I grew up on it, and you will always

be my enemy and never, rejected peace with you, the only relationship between us

and you is a state of permanent war, one day we will meet on the battlefield

Nikhila KJ on "how to make work in php page"

$
0
0

Hello,

I am using PHP Code for posts to write php codes in pages. and i wanted to use <!--nextpage--> for pagination.
But i am getting below error
Parse error: syntax error, unexpected $end in /home/yhmjmuia/public_html/wp-content/plugins/php-code-for-posts/PHPPostCode.php(59) : eval()’d code on line 92

Please help me sort this.
Thank you

manolze on "WooCommerce Email Order Items Variations"

$
0
0

Hello

I'm having trouble formatting the variations output in my emails-order-items.php template

http://pastebin.com/VGyPzPag

This is the line that outputs the variations in my emails

// Variation
echo ($item_meta->meta) ? '
<small>' . nl2br( $item_meta->display( true, true ) ) . '</small>' : '';

How do I format it this so I can control style of variations and attributes independently?

<small> tags style the entire output and won't give me style attribute only

I have looked at http://woocommerce.wp-a2z.org/oik_api/wc_order_item_metadisplay/ but im not too great with code and am unsure as to how to implement this into my php

https://wordpress.org/plugins/woocommerce/

ali971 on "show recent posts from excluded category"

$
0
0

hello
i want to exclude category posts from index & archive page

so i wrote this script in functions.php

function exclude_category($query) {
        if ( $query->is_home() || $query->is_archive()  ) {
        $query->set('cat', '-33799');
        }
        return $query;
}
        add_filter('pre_get_posts', 'exclude_category');

everything works fine till here , but i need to some latest posts from this category in a box in all of pages

<?php
    $args = array ( 'category' => "33799", 'posts_per_page' => 2);
    $recentposts = get_posts( $args );
    foreach ($recentposts as $post) : setup_postdata($post);
         if ( get_post_meta($post->ID,"news_thumb", TRUE) ) {
             $img = get_post_custom_values("news_thumb", $post->ID);
         } else {
             $img = 'images/no_pic.jpg';
             }
         if ( get_post_meta($post->ID,"news_short_content", TRUE) ) {
             $content = get_post_custom_values("news_short_content", $post->ID);
         } else {
             $content = '';
             }
    ?>

SHOW_SOMETHING_IN_LOOP

<?php endforeach; ?>

when i add this script to header.php I've get wrong output , i can understand why this is happening

because i excluded category in query , but i have no idea how can i fix this

wpdev87 on "Using Wordpress to add content to other Database table"

$
0
0

I'm building a system where the products are read in from a 3rd party. I have these read in and stored in a database. This third party can add products, edit products and remove products also.

What I want is something like a custom post type where each of these products are selectable to add extra content such as images, copy, maybe some ACF data, meta (using the third part plugin), etc.

Any one know how to do this? I don't want the original data editable just to expand upon it.

Anybody know of a way to do this? Or some sort of a clue? Thank you in advance!

aseliot on "Add files from path to load alongside others in medialibrary"

$
0
0

Is it possible to create a plugin that upon activation configures the medialibrary of the site (in multi-site) to load other images from a given path alongside the one's that are loaded from the default folder (the one for example in upload/2015/3/...)

There don't seem to be any hooks or filters available for this as far as I can see. I'm not even sure if it is possible as I don't have that much knowledge about the wp system yet.


dmitry8 on "$wpdb Object error"

$
0
0

I use $wpdb Object to talk to the database and handle some of the functions in the form on this page. http://www.cmslaser.com/laser-capabilities/laser-marking

It's the blue form on the right

I'm calling wpdb() class

When I use $wpdb->update I can't get any data to populate in my database.
Connection seems to be fine

this is where it's having problems

<?php $wpdb->insert( $leads_table, $data, $format ); ?>

Let me know if anyone is having similar issues

Thanks
Dmitry

zeaks on "Theme customizer image_control add_image_size?"

$
0
0

Is there any way to make WP_Customize_Image_Control use a specific image size? All I could find was a way to recommend a size

jheck_hwoarang on "How to make backgrond image clickable with link"

$
0
0

this is my website

i want the custom background to be clickable with custom URL to got to any link I want

please help

RudolfFiedler on "serialized data in longtext-fields"

$
0
0

the php-documtation says, that serialized data would better saved in blob-fields as in text-fields. (http://php.net/manual/de/function.serialize.php)
The wp-tables wp-options, wp_postmeta und wp_usermeta uses mysql-field-type longtext.
Wy not blob-fields?
Thanks,

Rudi

boybawang on "How to get current page URL regardless of permalink settings"

$
0
0

I'm familiar with get_permalink() to get the permalink URL, but I need to get the URL of the page regardless of the user having permalink settings or not. In other words, if they have the 'default' permalink settings, I would like that URL.

For example, suppose I have a page whose ID is 12345. The permalink URL might look something like this:

http://www.domain.com/some_page/

The 'default' URL might look like this:

http://www.domain.com/?page_id=12345.

Is there a WP specific function to obtain this URL? I'm familiar with $_SERVER['REQUEST_URI'] and $_SERVER['PHP_SELF'] , but was hoping for something WP specific.

Thanks

Viewing all 8245 articles
Browse latest View live


Latest Images