Distributor: Syncing Authors Between Multiple Networks

Created on 21 Jul 2019  路  14Comments  路  Source: 10up/distributor

Describe your question
Hi, we have multiple multi-site networks. However the authors are only one one website (the main site). We distribute posts from the mainsite to all the other sub-sites in multiple domains in multiple multi-site networks. Till now with the help of Distributor all we could do was transfer the posts successfully to other networks but the problem was in Author linking. Instead of linking to the mainsite (homepage) we wanted to refer to the author profile of the mainsite instead of the homepage. Is it possible anyhow?

If yes, no matter how complex the solution is, could I get help with this? This plugin solves literally almost all of our issues except this. God forbid what we would've done if this plugin didn't exist. Good work, keep it up! <3

Reporter Feedback question

All 14 comments

@startwd in the Distributor Settings page, if you have Override Author Byline enabled then it will replace the author name and link with the original site name and link on your distributed posts. Is that the functionality you're looking for?

We did try that but instead of replacing with the original site name and link we want to replace the author name and link with the original site's author's name and link. Hope I made myself clear. I've seen some codes across the amalgamation of threads here but eventually got lost. I think there is some extended code that will enable this to do so?

Apologies @startwd, I read your initial question a bit too quickly and missed some of the context you provided. It does not appear that the enabled or disabled option for the "Override Author Byline" will accomplish what you're looking for.

You could extend Distributor using existing hooks and filters to add some code to your multisite setup that would filter if a post is distributed to then find the author on your original site and link to that profile. I can dig up the specific code reference if that's the approach you'd like to take.

Otherwise, we have paid implementation and support options where we could help resolve this for you, so if that's the approach you'd like to take then email me at jeff.[email protected] and we can craft a small engagement to help.

@jeffpaul the extended code is exactly what I need. Could you email me the extended code and all the necessities along with it? This would be a huge help! Thank you so much. My email: [email protected]

Also @jeffpaul if you could email me the code that would do the following work it would be a blessing:

I wanted to distribute posts before they are published while they are in the pending state. Is it possible? If yes, could you add this code in the email too? Thanks a bunch!

@startwd I just sent you an email to follow up on the options available for your requests here and I look forward to helping ensure you're set up to use Distributor successfully for your sites!

Hi @startwd here are some answers to your questions, hope this helps:

I wanted to distribute posts before they are published while they are in the pending state. Is it possible?

Yes, you can use the dt_allow_as_draft_distribute filter for this. Code sample:

add_filter( 'dt_allow_as_draft_distribute', '__return_true' );

Instead of linking to the mainsite (homepage) we wanted to refer to the author profile of the mainsite instead of the homepage.

Yes, you can accommodate this feature in your theme code. In your single post or archive template where you are displaying the author name, you will need to add a custom function to link back to the original author profile.

Since this is a network install, you will already have all the information you need to determine the URL to the original author's profile. In particular the meta fields: dt_original_post_id and dt_original_blog_id will let you determine the original author profile.

You can add this functionality in the template(s), however even better would be adding the information into post meta once - right when you push the post. You can do this by hooking in with the dt_push_post filter.

Here are some code snippets that should do what you want (note, these are untested, let me know if you have any trouble):

// When a post is pushed, add the author profile URL to the distributed post meta.
add_action( 'dt_push_post', function( $new_post_id, $post_id ) {
    $source_post = get_post( $post_id );
    $source_author_url = get_author_posts_url( (int) $source_post->post_author );
    update_post_meta( $new_post_id, 'dt_source_post_author_url', $source_author_url );
}

Then in your templates you can use the dt_source_post_author_url meta for the link if available.

Let me know if you have any questions.

Thanks for your questions. We will work to add more examples for these types of requests to the documentation. I'm closing this issue for now, please reopen if I have missed anything.

Hi Adam,

Thanks for your response! We are using multi-site network as mentioned earlier, living as main site & subdomains and instead of just crediting the author with the link we want the authors to be properly synced during a push. Just the same way how the pull option works.

For example, when pulling a content the original author is set as the post author on main site. We wanted to replicate this on push functionality. I think there are many users who would want the same as it's always easier to just push with the same functionalities than pulling it.

We need the same function in push since we usually keep a track of the post view count accrued by our authors on multi-site level.

instead of just crediting the author with the link we want the authors to be properly synced during a push.

@startwd thanks for the feedback...

Ah, that wasn't clear before: this works correctly for pulls, but not for pushes? I didn't understand that previously, I'll try to confirm locally.

Question: is your goal that the user will be added to the distributed site if they don't already exist there? (eg they are on the network, but not added to the site)?

@adamsilverstein The users already exist in all of the subsites and parent sites inside the multisite network. That is why when pulling a post it was possible for the author data to be pulled as well. But when I'm pushing a post to a distributed network, it makes the pushing account the author of the post. I was wondering if there was any code that could go into functions.php which would stop this and let the original author of the post to be retained?

But when I'm pushing a post to a distributed network, it makes the pushing account the author of the post. I was wondering if there was any code that could go into functions.php which would stop this and let the original author of the post to be retained?

@startwd thanks for clarifying - one more question - are you also running the same theme (or code you control) on each remote site in the distributed network?

@startwd can you please confirm that you're running the same theme on each remote site in the network?

@startwd can you please confirm that you're running the same theme on each remote site in the network?

@startwd I'm closing this issue for lack of response, but if you're able to respond with an update then we can re-open and continue to help answer your question. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wisnetmaster picture wisnetmaster  路  7Comments

jeffpaul picture jeffpaul  路  5Comments

hreimer picture hreimer  路  5Comments

avag-novembit picture avag-novembit  路  3Comments

vimalagarwalasentech picture vimalagarwalasentech  路  5Comments