bambinou
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to hide absolute wordpress paths in the html codeHi,
Yes this is my problem, if I rename it I have to hard code everything in multiple files as it will not work anymore.
Thanks for your help,
Ben
Forum: Fixing WordPress
In reply to: Cache problems with pluginsYes thank you,
I have found the culprit, it was the Custom Page Order.
Thanks again!
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemThanks! Yes just found this folder ??
Thank you!
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemThank you so much for all your help and Merry Xmas to all!(If you party it of course……)
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemYes you are totally right about custom page, it is better to hardcode this rather than adding plugins that will perhaps cause others problems.
oK, I think I will work out how to make a template, the only thing I would like to know, is where to drop the template files I create? I clicked on “add new page”, on the right side of the screen I can now see an option that let you choose a template, this is perfect but I just do not know what is the master folder for all these templates, any idea please?
Thank you,
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemThank you for your great help and reply.
I would like to ask you a last thing please, what is the best best to create a custom page?
Do I just create a normal page in the public_html folder? Or is their a way to use the actual layout of the site?
Thank you,
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemThe plugin I am using to output php on the wordpress post is “Allow PHP in posts and pages” is this can help.
I have been on it for 3 days now……..using 3 forums at the same time and no one seem to be able to find a solution, this is just so strange….. Is it a problem with wordpress itself?
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemThanks you for your help,
Ok, I have added your code and now the output (source) shows both widgets and not 1 at the time, this is weird:
[Code moderated as per the Forum Rules. Please use the pastebin]
[please ensure that your code is enclosed in backticks (`) or use the code button.]
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemMy problem really is not to have this code working on a plain php file but rather in a wordpress post. I just cannot output the required widget in a post via this code. But strangely this code here without javascript in it works perfectly
[php]if (is_user_logged_in()) {
echo ‘helllllllllllllllllloooooooooooooooooo’;
} else {
echo ‘helllllllllllllllooooooooooooo222222’;
}[/php]
This is what I cannot work out. I used the exact same php code but added javascript in between the quotes, that’s all. therefore it must have a conflict in the js itself….but what?Thank you,
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemHi MusicalDustBin,
I am trying to post this code into a wordpress post, I have downloaded the php plugin called “allow php in post and pages”. By pasting the code into the page, it should work, actually this one works fine.
[php]if (is_user_logged_in()) {
echo ‘helllllllllllllllllloooooooooooooooooo’;
} else {
echo ‘helllllllllllllllooooooooooooo222222’;
}[/php]Now the reason you see <p> tags everywhere is because I copied it from wordpress directly, here is my version from the php editor:
<?php if ( is_user_logged_in() ) { <!--leaderboard Start--> echo '<div id="leaderboard_widget"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"> </script> <script type="text/javascript">Mochi.showLeaderboardWidget({game: "santas-battlefield", partnerID: "ffa761aaf7ff9d0d", id: "leaderboard_widget"})</script> <!--leaderboard End--><br> <!--Bridge Start--> <div id="leaderboard_bridge"></div> <script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script> <script type="text/javascript">var options = {partnerID: "ffa761aaf7ff9d0d", id: "leaderboard_bridge"}; options.username = "global $current_user; echo $current_user->user_login;"; Mochi.addLeaderboardIntegration(options); </script>'; <!--Bridge End--> } else { echo ' <div id="leaderboard_widget"></div> <script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"> </script> <script type="text/javascript">Mochi.showLeaderboardWidget({game: "santas-battlefield", partnerID: "ffa761aaf7ff9d0d", id: "leaderboard_widget"})</script> <!--leaderboard End--><br> <!--Bridge Start--></ <div id="leaderboard_bridge"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script> <script type="text/javascript">var options = {partnerID: "ffa761aaf7ff9d0d", id: "leaderboard_bridge"}; options.denyScores = "Login to Example to submit scores!"; Mochi.addLeaderboardIntegration(options); </script>'; <!--Bridge End--> } ?>
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemi have 2 widgets with gaming scores, one widget will take the logged in username name and post it to the leaderboard while the other widget will tell the people to register on the site in order to post a score.
Thats the way the game publisher wrote his code, now I need a function that output widget 1 if the user is logged in or widget 2 if he isn’t logged in.Thank you, I hope you understand a bit more what I am trying to achieve.
Ben
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblem<p> <?php if ( is_user_logged_in() ) { ?> <div id="leaderboard_widget"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"> </script> <script type="text/javascript">Mochi.showLeaderboardWidget({game: "santas-battlefield", partnerID: "ffa761aaf7", id: "leaderboard_widget"})</script> <!--leaderboard End--> <!--Bridge Start--></</p> <div id="leaderboard_bridge"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script> <script type="text/javascript">var options = {partnerID: "ffa761aaf7", id: "leaderboard_bridge"}; options.username = "<?php global $current_user; echo $current_user->user_login;?>"; Mochi.addLeaderboardIntegration(options); </script> <?php } else { ?> </p> <div id="leaderboard_widget"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"> </script> <script type="text/javascript">Mochi.showLeaderboardWidget({game: "santas-battlefield", partnerID: "ffa761aaf7", id: "leaderboard_widget"})</script> <!--leaderboard End--> <!--Bridge Start--></</p> <div id="leaderboard_bridge"></div> <p><script src="https://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script> <script type="text/javascript">var options = {partnerID: "ffa761aaf7", id: "leaderboard_bridge"}; options.denyScores = "Login to Example to submit scores!"; Mochi.addLeaderboardIntegration(options); </script> <?php } ?>
Sorry musicaldustbin but you have lost me on that one
Forum: Fixing WordPress
In reply to: wordpress is_user_logged_inproblemHi James,
Thank you for your help.
This is very strange because the way you wrote it works, it detects I am logged in and output the right “echo”.
Now if I populate both the “echo” with my widget code(js), It does not output them on the page, logged in or not, I tried to write the expression using your way by using [php] and [/php] at the top and bottom of the code and some of the php code is showing up in the post.
<p><!–Flash Game Start–>
<embed src=”https://games.mochiads.com/c/g/santas-battlefield/SantaZombieShooter.swf” menu=”false” quality=”high” width=”640″ height=”535″ type=”application/x-shockwave-flash” pluginspage=”https://www.macromedia.com/go/getflashplayer”></embed>
<!–Flash Game End–></p>
<p>[php]
if ( is_user_logged_in() ) {
<!–leaderboard Start–>
echo ‘[/php]<div id=”leaderboard_widget”></div>
<p><script src=”https://xs.mochiads.com/static/pub/swf/leaderboard.js” type=”text/javascript”>
</script>
<script type=”text/javascript”>Mochi.showLeaderboardWidget({game: “santas-battlefield”, partnerID: “ffa761aaf7”, id: “leaderboard_widget”})</script>
<!–leaderboard End–><!–Bridge Start–></</p>
<div id=”leaderboard_bridge”></div>
<p><script src=”https://xs.mochiads.com/static/pub/swf/leaderboard.js” type=”text/javascript”></script>
<script type=”text/javascript”>var options = {partnerID: “ffa761aaf7”, id: “leaderboard_bridge”};
options.username = “[php]global $current_user; echo $current_user->user_login;[/php]“;
Mochi.addLeaderboardIntegration(options);
</script>[php]‘;
<!–Bridge End–>
} else {
echo ‘[/php]</p>
<div id=”leaderboard_widget”></div>
<p><script src=”https://xs.mochiads.com/static/pub/swf/leaderboard.js” type=”text/javascript”>
</script>
<script type=”text/javascript”>Mochi.showLeaderboardWidget({game: “santas-battlefield”, partnerID: “ffa761aaf7”, id: “leaderboard_widget”})</script>
<!–leaderboard End–><!–Bridge Start–></</p>
<div id=”leaderboard_bridge”></div>
<p><script src=”https://xs.mochiads.com/static/pub/swf/leaderboard.js” type=”text/javascript”></script>
<script type=”text/javascript”>var options = {partnerID: “ffa761aaf7”, id: “leaderboard_bridge”};
options.denyScores = “Login to Example to submit scores!”;
Mochi.addLeaderboardIntegration(options);
</script>[php]‘;
<!–Bridge End–>
}
[/php]Please see this page:
https://www.maltaon(dot)com/test
Please replace the (.) , I do not want Google to crawl my site yet as it is not finished.
Forum: Fixing WordPress
In reply to: How to pass on logged username?Thank you very much for that,
I have looked at the link you have posted and this also could work I believe:
<?php
wp_get_current_user();
echo ‘Username: ‘ . $current_user->user_login . ‘
‘;
?>I will try it now to see if it works,
A last question please, can you output this “<?php
wp_get_current_user();
echo ‘Username: ‘ . $current_user->user_login . ‘
‘;
?> ” in a javascript function or not? As(only part of the function here):options.username = “<?php global $current_user; echo $current_user->user_login; ?>”;
Thank you,
Ben
Forum: Fixing WordPress
In reply to: How to pass wordpress username data is another script?I have just looked at my template and found this:
<h1><?php echo get_the_author(); ?></h1>
Could this not be the one?
Thank you,
Ben