dimanche 26 juin 2016

Wordpress authentication outside wordpress

Fist of all, my PHP skills are almost zero, I used to have a friend to make this kind of things and I'm more into css and html and making the content of the web but since He disappeared I have to be in charge of this web of mine that works in Wordpress. He made an awesome app to download files that is not a WP Plugin but works fine, the only thing I wanna do is to make that tool into a "just if logged into the main web" tool. When click on the link that is manually generated it loads in a new page like:

"myweb[dot]com/folder1/Down.php?id=..."

I found that file ' Down.php ' that is something like this:

<?php
.
.
.
?>
<!DOCTYPE html>
<html lang="es-ES">
.
.
.
</html>

but I don't know how to add the wordpress user authentication, I found a code that could work... maybe, but I don't know how to use it, If you know how to do this or know another way I would very thankful if you could help me.

<?php 
if ( is_user_logged_in() ) :

    // Contenido solo para usuarios registrados    

else :

    // Mensaje para los que no pueden ver el contenido anterior
    echo 'Lo sentimos, este contenido sólo está disponible para usuarios registrados :-(';

endif;
?>

I already found a way to restrict the link's visiblity on the web(with a WP Plugin), but I also found that It's pretty easy to avoid it by guessing the direct link and that's pretty easy. Please, help me with this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire