Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: messaddek on March 31, 2020, 06:48:35 AM

Title: Connect SMF to wordpress login
Post by: messaddek on March 31, 2020, 06:48:35 AM
Hello,

I've created a SimpleMachines forum with paid subscription system.

I would like to connect forum registration to WordPress login/membership to have an SSO.

Or I would like to allow users to choose subscription on the register.

Could you please help?

Regards
Title: Re: Connect SMF to wordpress login
Post by: vbgamer45 on April 03, 2020, 12:50:12 PM
Nice, find! I will check that out myself.
Title: Re: Connect SMF to wordpress login
Post by: Hind24P on April 09, 2020, 01:11:09 PM
Following that, it'd be good to have some compatibility with Wordpress.
Title: Re: Connect SMF to wordpress login
Post by: vbgamer45 on April 09, 2020, 01:16:06 PM
Here is one SMF to Wordpress
https://www.smfhacks.com/index.php?action=downloads;sa=view;down=228

The second part is Wordpress To SMF
https://github.com/xchwarze/WP2SMFBridge
Title: Re: Connect SMF to wordpress login
Post by: drewactual on April 16, 2020, 11:41:13 PM
B-E-A-Utiful!!!

if anyone wants a copy of a function i drafted to display WP posts in SMF, (you can see it live at https://www.carolina-woodworkers.com ; it will be evident when the page loads) let me know!!!  it's super simple and i should have socialized it before now. 
Title: Re: Connect SMF to wordpress login
Post by: vbgamer45 on April 16, 2020, 11:47:31 PM
Sure post it every bit helps :)
Title: for adding WP links and title blocks to SMF
Post by: drewactual on April 17, 2020, 12:13:15 AM
-you'll want to inject a conditional php script because you most likely don't want this on every page.
-you'll want to play with the code i'm about to provide.. i'm providing the style "I" used so you have a starting block, and the code here only show 3 blocks that have some dynamic effect on hover... you can dump that with the css provided.

this is something of a breakthrough with WP/SMF sites having the login shared, and this may compliment folks using the two systems as stand alone... to further join them short of integration.

the script i'm offering is for most recent WP posts, but can also do specific categories.. I ALSO am providing a default image for WP posts that don't have an image, so something (one of three, as it is) will show up in those posts... IF the post has an image, it will show that image.

I use this in a free standing file which is conditional so it only shows on the index page... you can interject it directly to your index.template or where ever you want... the conditional usage serves most folks best, and i can show you how to do that if you don't know.

anyway, the WP 'inject' code:

<div class="cat_bar" id="category"><h3 class="catbg"><a href="/publisher" target="_blank">THE TITLE BAR TEXT</h3></a><div class="desc">MORE TITLE BAR TEXT</div></div>

<div class="catbg" style="background:#fff;padding:20px auto">
<?php $wp_query = new \WP_Query(); $wp_query->query('showposts=3'); while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<div class="sneekerz">
<a href="<?php the_permalink() ?>"target="_blank"><div class="titlez-sneek"><?php the_title(); ?></div><?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { ?><?php echo'<img src="/images/wp-random/';$random=rand(1,3);echo$random;echo'.jpg"  alt="random featured image" title="random featured image when one not provided"/>';?><?php ?></a>
</div>

<?php endwhile; ?>
</div>
<?php wp_reset_query(); ?>


and the css i use for the style in the inject:

#pub-boxz{display:block;width:100%;height:auto;margin:10px auto;}
.sneekerz {display:inline-block;width:28%;margin:45px 20px;box-shadow:0 0 10px #784212;border-radius:.5em;background:#fff;font-weight:600;font-size:16pt;padding:10px;line-height:1.5;height:250px;overflow:hidden;transform:scale(.95);}
.sneekerz img{width:100%;height:auto;margin:0 auto;border-radius:.5em;}
.sneekerz:hover{transform:scale(1.15);}
.sneekerz .titlez-sneek{display:block;width:95%;margin:10px auto;padding:5px;text-align:center;font-size:12pt;background:#fcfbb6;border-radius:.5em;}
a:link .titlez-sneek{color:#784212;}
a:visited .titlez-sneek{color:#784212;}
a:active .titlez-sneek{color:#784212;}
a:hover .titlez-sneek{color:#784212;}

@media only screen and (max-width:1024px){
#pub-boxz{margin:10px 0;}
#pub-boxz .sneekerz{width:27%;margin:0 10px;}
}


NOTE: to use the random image in the case a WP post doesn't have one, you MUST add a folder to your top directory named "images" ( there is likely one already there) and with a SUB-DIRECTORY named "wp-random"... in that file, add 3 images that are named 1.jpg, 2.jpg, 3.jpg (following that naming convention strictly- jpg's and simple numbers).  poof- you'll have a random fall-back image when your WP post doesn't have one, which will keep your page looking tidy.

just for shtz and grins, i'm going to link instructions on how to do the conditional script to... it's handy to have if you want to show something (a banner perhaps?) on a specific board, or to show (or not) on the index of your forum.  if you follow the link to the page i provided above you'll see how it can REALLY tidy up a SMF+WP website.  the instructions for that are at  https://www.simplemachines.org/community/index.php?topic=572749.0 and starting at post #6...